zkEVM node vs CDK validium node

zkevm-node version: v0.6.0

Files changed (110) hide show
  1. {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/aggregator.go +136 -22
  2. {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/aggregator_test.go +5 -5
  3. {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/config.go +23 -0
  4. {/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/interfaces.go +1 -0
  5. {/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/approve.go +2 -2
  6. {/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/main.go +8 -1
  7. {/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/policy.go +308 -0
  8. {/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/run.go +117 -17
  9. {/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/set_data_availability_protocol.go +68 -0
  10. {/home/stefan/go/src/Polygon/zkevm-node → .}/config/cardonagenesis.go +0 -109
  11. {/home/stefan/go/src/Polygon/zkevm-node → .}/config/config.go +20 -1
  12. {/home/stefan/go/src/Polygon/zkevm-node → .}/config/config_test.go +12 -10
  13. {/home/stefan/go/src/Polygon/zkevm-node → .}/config/default.go +5 -2
  14. {/home/stefan/go/src/Polygon/zkevm-node → .}/config/mainnetgenesis.go +0 -107
  15. {/home/stefan/go/src/Polygon/zkevm-node → .}/config/network.go +9 -15
  16. {/home/stefan/go/src/Polygon/zkevm-node → .}/config/network_test.go +5 -15
  17. {/home/stefan/go/src/Polygon/zkevm-node → .}/config/testnetgenesis.go +0 -108
  18. {/home/stefan/go/src/Polygon/zkevm-node → .}/config/types/duration.go +10 -0
  19. {/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/config.go +9 -0
  20. {/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/dataavailability.go +116 -0
  21. {/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/datacommittee/datacommittee.go +295 -0
  22. {/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/datacommittee/datacommittee_test.go +131 -0
  23. {/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/interfaces.go +43 -0
  24. {/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/pool/validium-001.sql +20 -0
  25. {/home/stefan/go/src/Polygon/zkevm-node → .}/diffgen.sh +47 -0
  26. {/home/stefan/go/src/Polygon/zkevm-node → .}/Dockerfile +0 -1
  27. {/home/stefan/go/src/Polygon/zkevm-node → .}/Dockerfile.release +12 -0
  28. {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/etherman.go +159 -174
  29. {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/etherman_test.go +35 -32
  30. {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/interfaces.go +7 -0
  31. {/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/simulated.go +26 -2
  32. {/home/stefan/go/src/Polygon/zkevm-node → .}/ethtxmanager/ethtxmanager.go +4 -33
  33. {/home/stefan/go/src/Polygon/zkevm-node → .}/ethtxmanager/ethtxmanager_test.go +8 -8
  34. {/home/stefan/go/src/Polygon/zkevm-node → .}/ethtxmanager/interfaces.go +0 -2
  35. {/home/stefan/go/src/Polygon/zkevm-node → .}/ethtxmanager/pgstorage.go +0 -44
  36. {/home/stefan/go/src/Polygon/zkevm-node → .}/ethtxmanager/pgstorage_test.go +0 -66
  37. {/home/stefan/go/src/Polygon/zkevm-node → .}/event/event.go +3 -0
  38. {/home/stefan/go/src/Polygon/zkevm-node → .}/.golangci.yml +3 -0
  39. {/home/stefan/go/src/Polygon/zkevm-node → .}/go.mod +24 -21
  40. {/home/stefan/go/src/Polygon/zkevm-node → .}/.goreleaser-cdk.yaml +78 -0
  41. {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/client/zkevm_test.go +0 -25
  42. {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/endpoints_eth.go +3 -0
  43. {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/endpoints_eth_test.go +235 -0
  44. {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/policy.go +61 -0
  45. {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/types/errors.go +2 -0
  46. {/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/types/interfaces.go +1 -0
  47. {/home/stefan/go/src/Polygon/zkevm-node → .}/merkletree/tree.go +0 -3
  48. {/home/stefan/go/src/Polygon/zkevm-node → .}/merkletree/tree_test.go +0 -86
  49. {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/errors.go +9 -0
  50. {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/interfaces.go +10 -0
  51. {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/pgpoolstorage/policy.go +202 -0
  52. {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/policy.go +43 -0
  53. {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/pool.go +12 -1
  54. {/home/stefan/go/src/Polygon/zkevm-node → .}/pool/pool_test.go +66 -0
  55. {/home/stefan/go/src/Polygon/zkevm-node → .}/proto/src/proto/executor/v1/executor.proto +1 -0
  56. {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/batch.go +9 -4
  57. {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/finalizer.go +13 -2
  58. {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/forcedbatch.go +1 -0
  59. {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/l2block.go +3 -1
  60. {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/config.go +2 -0
  61. {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/interfaces.go +6 -2
  62. {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/sequencesender.go +19 -103
  63. {/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/sequencesender_test.go +1 -1
  64. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/batch.go +0 -17
  65. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/batchV2.go +4 -13
  66. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/convertersV2.go +0 -1
  67. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/encoding_batch_v2.go +50 -116
  68. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/encoding_batch_v2_test.go +6 -44
  69. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/genesis.go +5 -3
  70. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/helper.go +3 -3
  71. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/interfaces.go +3 -1
  72. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/batch.go +22 -3
  73. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/pgstatestorage.go +15 -0
  74. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/pgstatestorage_test.go +27 -1
  75. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/runtime/executor/client.go +7 -0
  76. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/test/forkid_etrog/etrog_test.go +3 -5
  77. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/trace.go +1 -0
  78. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/transaction.go +13 -0
  79. {/home/stefan/go/src/Polygon/zkevm-node → .}/state/types.go +2 -0
  80. {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/etrog/processor_l1_sequence_batches.go +3 -3
  81. {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/etrog/processor_l1_update_etrog_sequence.go +1 -1
  82. {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/config.go +0 -2
  83. {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l1_parallel_sync/l1_worker_etherman_test.go +1 -1
  84. {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/config.go +0 -8
  85. {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/l2_shared/processor_trusted_batch_sync.go +6 -29
  86. {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/l2_shared/tests/processor_trusted_batch_sync_test.go +4 -55
  87. {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/l2_sync_etrog/executor_trusted_batch_sync.go +10 -22
  88. {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/l2_sync_etrog/executor_trusted_batch_sync_test.go +0 -40
  89. {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/l2_sync_incaberry/sync_trusted_state.go +1 -0
  90. {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/synchronizer.go +44 -17
  91. {/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/synchronizer_test.go +6 -9
  92. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/auto/customModExp.sol +24 -0
  93. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/bin/customModExp/customModExp.go +0 -224
  94. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/bin/triggerErrors/triggerErrors.go +1 -1
  95. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/docker-compose.yml +49 -1
  96. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/datacommittee_test.go +270 -0
  97. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/debug_calltracer_test.go +1 -1
  98. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/forced_batches_test.go +1 -1
  99. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/forced_batches_vector_shared.go +2 -2
  100. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/state_test.go +1 -1
  101. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/Makefile +46 -4
  102. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/operations/manager.go +21 -1
  103. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/batchsender/main.go +2 -2
  104. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/deploy_sc/main.go +6 -0
  105. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/hash_compare/main.go +0 -124
  106. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/hash_gen/main.go +0 -188
  107. {/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/http_ws_sync/main.go +0 -161
  108. {/home/stefan/go/src/Polygon/zkevm-node → .}/tools/egp/main.go +83 -183
  109. {/home/stefan/go/src/Polygon/zkevm-node → .}/tools/state/main.go +1 -1
  110. {/home/stefan/go/src/Polygon/zkevm-node → .}/tools/state/reprocess_cmd.go +1 -1
{/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/aggregator.go RENAMED
@@ -2,6 +2,7 @@
2
 
3
  import (
4
  "context"
 
5
  "encoding/json"
6
  "errors"
7
  "fmt"
@@ -65,6 +69,9 @@
65
  srv *grpc.Server
66
  ctx context.Context
67
  exit context.CancelFunc
 
 
 
68
  }
69
 
70
  // New creates a new aggregator.
@@ -73,6 +80,8 @@
73
  stateInterface stateInterface,
74
  ethTxManager ethTxManager,
75
  etherman etherman,
 
 
76
  ) (Aggregator, error) {
77
  var profitabilityChecker aggregatorTxProfitabilityChecker
78
  switch cfg.TxProfitabilityCheckerType {
@@ -94,6 +103,9 @@
94
  TimeCleanupLockedProofs: cfg.CleanupLockedProofsInterval,
95
 
96
  finalProof: make(chan finalProofMsg),
 
 
 
97
  }
98
 
99
  return a, nil
@@ -267,34 +279,139 @@
267
 
268
  log.Infof("Final proof inputs: NewLocalExitRoot [%#x], NewStateRoot [%#x]", inputs.NewLocalExitRoot, inputs.NewStateRoot)
269
 
270
- // add batch verification to be monitored
271
- sender := common.HexToAddress(a.cfg.SenderAddress)
272
- to, data, err := a.Ethman.BuildTrustedVerifyBatchesTxData(proof.BatchNumber-1, proof.BatchNumberFinal, &inputs, sender)
273
- if err != nil {
274
- log.Errorf("Error estimating batch verification to add to eth tx manager: %v", err)
275
- a.handleFailureToAddVerifyBatchToBeMonitored(ctx, proof)
276
- continue
277
- }
278
- monitoredTxID := buildMonitoredTxID(proof.BatchNumber, proof.BatchNumberFinal)
279
- err = a.EthTxManager.Add(ctx, ethTxManagerOwner, monitoredTxID, sender, to, nil, data, a.cfg.GasOffset, nil)
280
- if err != nil {
281
- mTxLogger := ethtxmanager.CreateLogger(ethTxManagerOwner, monitoredTxID, sender, to)
282
- mTxLogger.Errorf("Error to add batch verification tx to eth tx manager: %v", err)
283
- a.handleFailureToAddVerifyBatchToBeMonitored(ctx, proof)
284
- continue
285
  }
286
 
287
- // process monitored batch verifications before starting a next cycle
288
- a.EthTxManager.ProcessPendingMonitoredTxs(ctx, ethTxManagerOwner, func(result ethtxmanager.MonitoredTxResult, dbTx pgx.Tx) {
289
- a.handleMonitoredTxResult(result)
290
- }, nil)
291
-
292
  a.resetVerifyProofTime()
293
  a.endProofVerification()
294
  }
295
  }
296
  }
297
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
  func (a *Aggregator) handleFailureToAddVerifyBatchToBeMonitored(ctx context.Context, proof *state.Proof) {
299
  log := log.WithFields("proofId", proof.ProofID, "batches", fmt.Sprintf("%d-%d", proof.BatchNumber, proof.BatchNumberFinal))
300
  proof.GeneratingSince = nil
@@ -1044,10 +1161,10 @@
1044
  }
1045
  if l1InfoRoot != nil && *l1InfoRoot != calculatedL1InfoRoot {
1046
  for i, l := range aLeaves {
1047
- log.Infof("AllLeaves[%d]: %s", i, common.Bytes2Hex(l[:]))
1048
  }
1049
  for i, s := range smtProof {
1050
- log.Infof("smtProof[%d]: %s", i, common.Bytes2Hex(s[:]))
1051
  }
1052
  return nil, fmt.Errorf("error: l1InfoRoot mismatch. L1InfoRoot: %s, calculatedL1InfoRoot: %s. l1InfoTreeIndex: %d", l1InfoRoot.String(), calculatedL1InfoRoot.String(), l2blockRaw.IndexL1InfoTree)
1053
  }
 
2
 
3
  import (
4
  "context"
5
+ "crypto/ecdsa"
6
  "encoding/json"
7
  "errors"
8
  "fmt"
 
69
  srv *grpc.Server
70
  ctx context.Context
71
  exit context.CancelFunc
72
+
73
+ AggLayerClient client.ClientInterface
74
+ sequencerPrivateKey *ecdsa.PrivateKey
75
  }
76
 
77
  // New creates a new aggregator.
 
80
  stateInterface stateInterface,
81
  ethTxManager ethTxManager,
82
  etherman etherman,
83
+ agglayerClient client.ClientInterface,
84
+ sequencerPrivateKey *ecdsa.PrivateKey,
85
  ) (Aggregator, error) {
86
  var profitabilityChecker aggregatorTxProfitabilityChecker
87
  switch cfg.TxProfitabilityCheckerType {
 
103
  TimeCleanupLockedProofs: cfg.CleanupLockedProofsInterval,
104
 
105
  finalProof: make(chan finalProofMsg),
106
+
107
+ AggLayerClient: agglayerClient,
108
+ sequencerPrivateKey: sequencerPrivateKey,
109
  }
110
 
111
  return a, nil
 
279
 
280
  log.Infof("Final proof inputs: NewLocalExitRoot [%#x], NewStateRoot [%#x]", inputs.NewLocalExitRoot, inputs.NewStateRoot)
281
 
282
+ switch a.cfg.SettlementBackend {
283
+ case AggLayer:
284
+ if success := a.settleWithAggLayer(ctx, proof, inputs); !success {
285
+ continue
286
+ }
287
+ default:
288
+ if success := a.settleDirect(ctx, proof, inputs); !success {
289
+ continue
290
+ }
 
 
 
 
 
 
291
  }
292
 
 
 
 
 
 
293
  a.resetVerifyProofTime()
294
  a.endProofVerification()
295
  }
296
  }
297
  }
298
 
299
+ func (a *Aggregator) settleDirect(
300
+ ctx context.Context,
301
+ proof *state.Proof,
302
+ inputs ethmanTypes.FinalProofInputs,
303
+ ) (success bool) {
304
+ // add batch verification to be monitored
305
+ sender := common.HexToAddress(a.cfg.SenderAddress)
306
+
307
+ to, data, err := a.Ethman.BuildTrustedVerifyBatchesTxData(
308
+ proof.BatchNumber-1,
309
+ proof.BatchNumberFinal,
310
+ &inputs,
311
+ sender,
312
+ )
313
+ if err != nil {
314
+ log.Errorf("Error estimating batch verification to add to eth tx manager: %v", err)
315
+ a.handleFailureToAddVerifyBatchToBeMonitored(ctx, proof)
316
+
317
+ return false
318
+ }
319
+
320
+ monitoredTxID := buildMonitoredTxID(proof.BatchNumber, proof.BatchNumberFinal)
321
+ err = a.EthTxManager.Add(
322
+ ctx,
323
+ ethTxManagerOwner,
324
+ monitoredTxID,
325
+ sender,
326
+ to,
327
+ nil,
328
+ data,
329
+ a.cfg.GasOffset,
330
+ nil,
331
+ )
332
+ if err != nil {
333
+ mTxLogger := ethtxmanager.CreateLogger(ethTxManagerOwner, monitoredTxID, sender, to)
334
+ mTxLogger.Errorf("Error to add batch verification tx to eth tx manager: %v", err)
335
+ a.handleFailureToAddVerifyBatchToBeMonitored(ctx, proof)
336
+
337
+ return false
338
+ }
339
+
340
+ // process monitored batch verifications before starting a next cycle
341
+ a.EthTxManager.ProcessPendingMonitoredTxs(
342
+ ctx,
343
+ ethTxManagerOwner,
344
+ func(result ethtxmanager.MonitoredTxResult, dbTx pgx.Tx) {
345
+ a.handleMonitoredTxResult(result)
346
+ },
347
+ nil,
348
+ )
349
+
350
+ return true
351
+ }
352
+
353
+ func (a *Aggregator) settleWithAggLayer(
354
+ ctx context.Context,
355
+ proof *state.Proof,
356
+ inputs ethmanTypes.FinalProofInputs,
357
+ ) (success bool) {
358
+ proofStrNo0x := strings.TrimPrefix(inputs.FinalProof.Proof, "0x")
359
+ proofBytes := common.Hex2Bytes(proofStrNo0x)
360
+ tx := tx.Tx{
361
+ LastVerifiedBatch: agglayerTypes.ArgUint64(proof.BatchNumber - 1),
362
+ NewVerifiedBatch: agglayerTypes.ArgUint64(proof.BatchNumberFinal),
363
+ ZKP: tx.ZKP{
364
+ NewStateRoot: common.BytesToHash(inputs.NewStateRoot),
365
+ NewLocalExitRoot: common.BytesToHash(inputs.NewLocalExitRoot),
366
+ Proof: agglayerTypes.ArgBytes(proofBytes),
367
+ },
368
+ RollupID: a.Ethman.GetRollupId(),
369
+ }
370
+ signedTx, err := tx.Sign(a.sequencerPrivateKey)
371
+
372
+ if err != nil {
373
+ log.Errorf("failed to sign tx: %v", err)
374
+ a.handleFailureToSendToAggLayer(ctx, proof)
375
+
376
+ return false
377
+ }
378
+
379
+ log.Debug("final proof signedTx: ", signedTx.Tx.ZKP.Proof.Hex())
380
+ txHash, err := a.AggLayerClient.SendTx(*signedTx)
381
+ if err != nil {
382
+ log.Errorf("failed to send tx to the interop: %v", err)
383
+ a.handleFailureToSendToAggLayer(ctx, proof)
384
+
385
+ return false
386
+ }
387
+
388
+ log.Infof("tx %s sent to agglayer, waiting to be mined", txHash.Hex())
389
+ log.Debugf("Timeout set to %f seconds", a.cfg.AggLayerTxTimeout.Duration.Seconds())
390
+ waitCtx, cancelFunc := context.WithDeadline(ctx, time.Now().Add(a.cfg.AggLayerTxTimeout.Duration))
391
+ defer cancelFunc()
392
+ if err := a.AggLayerClient.WaitTxToBeMined(txHash, waitCtx); err != nil {
393
+ log.Errorf("interop didn't mine the tx: %v", err)
394
+ a.handleFailureToSendToAggLayer(ctx, proof)
395
+
396
+ return false
397
+ }
398
+
399
+ // TODO: wait for synchronizer to catch up
400
+ return true
401
+ }
402
+
403
+ func (a *Aggregator) handleFailureToSendToAggLayer(ctx context.Context, proof *state.Proof) {
404
+ log := log.WithFields("proofId", proof.ProofID, "batches", fmt.Sprintf("%d-%d", proof.BatchNumber, proof.BatchNumberFinal))
405
+ proof.GeneratingSince = nil
406
+
407
+ err := a.State.UpdateGeneratedProof(ctx, proof, nil)
408
+ if err != nil {
409
+ log.Errorf("Failed updating proof state (false): %v", err)
410
+ }
411
+
412
+ a.endProofVerification()
413
+ }
414
+
415
  func (a *Aggregator) handleFailureToAddVerifyBatchToBeMonitored(ctx context.Context, proof *state.Proof) {
416
  log := log.WithFields("proofId", proof.ProofID, "batches", fmt.Sprintf("%d-%d", proof.BatchNumber, proof.BatchNumberFinal))
417
  proof.GeneratingSince = nil
 
1161
  }
1162
  if l1InfoRoot != nil && *l1InfoRoot != calculatedL1InfoRoot {
1163
  for i, l := range aLeaves {
1164
+ log.Info("AllLeaves[%d]: %s", i, common.Bytes2Hex(l[:]))
1165
  }
1166
  for i, s := range smtProof {
1167
+ log.Info("smtProof[%d]: %s", i, common.Bytes2Hex(s[:]))
1168
  }
1169
  return nil, fmt.Errorf("error: l1InfoRoot mismatch. L1InfoRoot: %s, calculatedL1InfoRoot: %s. l1InfoTreeIndex: %d", l1InfoRoot.String(), calculatedL1InfoRoot.String(), l2blockRaw.IndexL1InfoTree)
1170
  }
{/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/aggregator_test.go RENAMED
@@ -191,7 +191,7 @@
191
  stateMock := mocks.NewStateMock(t)
192
  ethTxManager := mocks.NewEthTxManager(t)
193
  etherman := mocks.NewEtherman(t)
194
- a, err := New(cfg, stateMock, ethTxManager, etherman)
195
  require.NoError(err)
196
  a.ctx, a.exit = context.WithCancel(context.Background())
197
  m := mox{
@@ -686,7 +686,7 @@
686
  ethTxManager := mocks.NewEthTxManager(t)
687
  etherman := mocks.NewEtherman(t)
688
  proverMock := mocks.NewProverMock(t)
689
- a, err := New(cfg, stateMock, ethTxManager, etherman)
690
  require.NoError(err)
691
  aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
692
  a.ctx, a.exit = context.WithCancel(aggregatorCtx)
@@ -1029,7 +1029,7 @@
1029
  ethTxManager := mocks.NewEthTxManager(t)
1030
  etherman := mocks.NewEtherman(t)
1031
  proverMock := mocks.NewProverMock(t)
1032
- a, err := New(cfg, stateMock, ethTxManager, etherman)
1033
  require.NoError(err)
1034
  aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
1035
  a.ctx, a.exit = context.WithCancel(aggregatorCtx)
@@ -1306,7 +1306,7 @@
1306
  ethTxManager := mocks.NewEthTxManager(t)
1307
  etherman := mocks.NewEtherman(t)
1308
  proverMock := mocks.NewProverMock(t)
1309
- a, err := New(cfg, stateMock, ethTxManager, etherman)
1310
  require.NoError(err)
1311
  aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
1312
  a.ctx, a.exit = context.WithCancel(aggregatorCtx)
@@ -1436,7 +1436,7 @@
1436
  ethTxManager := mocks.NewEthTxManager(t)
1437
  etherman := mocks.NewEtherman(t)
1438
  proverMock := mocks.NewProverMock(t)
1439
- a, err := New(cfg, stateMock, ethTxManager, etherman)
1440
  require.NoError(err)
1441
  aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
1442
  a.ctx, a.exit = context.WithCancel(aggregatorCtx)
 
191
  stateMock := mocks.NewStateMock(t)
192
  ethTxManager := mocks.NewEthTxManager(t)
193
  etherman := mocks.NewEtherman(t)
194
+ a, err := New(cfg, stateMock, ethTxManager, etherman, nil, nil)
195
  require.NoError(err)
196
  a.ctx, a.exit = context.WithCancel(context.Background())
197
  m := mox{
 
686
  ethTxManager := mocks.NewEthTxManager(t)
687
  etherman := mocks.NewEtherman(t)
688
  proverMock := mocks.NewProverMock(t)
689
+ a, err := New(cfg, stateMock, ethTxManager, etherman, nil, nil)
690
  require.NoError(err)
691
  aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
692
  a.ctx, a.exit = context.WithCancel(aggregatorCtx)
 
1029
  ethTxManager := mocks.NewEthTxManager(t)
1030
  etherman := mocks.NewEtherman(t)
1031
  proverMock := mocks.NewProverMock(t)
1032
+ a, err := New(cfg, stateMock, ethTxManager, etherman, nil, nil)
1033
  require.NoError(err)
1034
  aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
1035
  a.ctx, a.exit = context.WithCancel(aggregatorCtx)
 
1306
  ethTxManager := mocks.NewEthTxManager(t)
1307
  etherman := mocks.NewEtherman(t)
1308
  proverMock := mocks.NewProverMock(t)
1309
+ a, err := New(cfg, stateMock, ethTxManager, etherman, nil, nil)
1310
  require.NoError(err)
1311
  aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
1312
  a.ctx, a.exit = context.WithCancel(aggregatorCtx)
 
1436
  ethTxManager := mocks.NewEthTxManager(t)
1437
  etherman := mocks.NewEtherman(t)
1438
  proverMock := mocks.NewProverMock(t)
1439
+ a, err := New(cfg, stateMock, ethTxManager, etherman, nil, nil)
1440
  require.NoError(err)
1441
  aggregatorCtx := context.WithValue(context.Background(), "owner", "aggregator") //nolint:staticcheck
1442
  a.ctx, a.exit = context.WithCancel(aggregatorCtx)
{/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/config.go RENAMED
@@ -8,6 +8,17 @@
8
  "github.com/0xPolygonHermez/zkevm-node/encoding"
9
  )
10
 
 
 
 
 
 
 
 
 
 
 
 
11
  // TokenAmountWithDecimals is a wrapper type that parses token amount with decimals to big int
12
  type TokenAmountWithDecimals struct {
13
  *big.Int `validate:"required"`
@@ -89,6 +100,18 @@
89
  // UpgradeEtrogBatchNumber is the number of the first batch after upgrading to etrog
90
  UpgradeEtrogBatchNumber uint64 `mapstructure:"UpgradeEtrogBatchNumber"`
91
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  // BatchProofL1BlockConfirmations is number of L1 blocks to consider we can generate the proof for a virtual batch
93
  BatchProofL1BlockConfirmations uint64 `mapstructure:"BatchProofL1BlockConfirmations"`
94
  }
 
8
  "github.com/0xPolygonHermez/zkevm-node/encoding"
9
  )
10
 
11
+ // SettlementBackend is the type of the settlement backend
12
+ type SettlementBackend string
13
+
14
+ const (
15
+ // AggLayer settlement backend
16
+ AggLayer SettlementBackend = "agglayer"
17
+
18
+ // L1 settlement backend
19
+ L1 SettlementBackend = "l1"
20
+ )
21
+
22
  // TokenAmountWithDecimals is a wrapper type that parses token amount with decimals to big int
23
  type TokenAmountWithDecimals struct {
24
  *big.Int `validate:"required"`
 
100
  // UpgradeEtrogBatchNumber is the number of the first batch after upgrading to etrog
101
  UpgradeEtrogBatchNumber uint64 `mapstructure:"UpgradeEtrogBatchNumber"`
102
 
103
+ // SettlementBackend configuration defines how a final ZKP should be settled. Directly to L1 or over the Beethoven service.
104
+ SettlementBackend SettlementBackend `mapstructure:"SettlementBackend"`
105
+
106
+ // AggLayerTxTimeout is the interval time to wait for a tx to be mined from the agglayer
107
+ AggLayerTxTimeout types.Duration `mapstructure:"AggLayerTxTimeout"`
108
+
109
+ // AggLayerURL url of the agglayer service
110
+ AggLayerURL string `mapstructure:"AggLayerURL"`
111
+
112
+ // SequencerPrivateKey Private key of the trusted sequencer
113
+ SequencerPrivateKey types.KeystoreFileConfig `mapstructure:"SequencerPrivateKey"`
114
+
115
  // BatchProofL1BlockConfirmations is number of L1 blocks to consider we can generate the proof for a virtual batch
116
  BatchProofL1BlockConfirmations uint64 `mapstructure:"BatchProofL1BlockConfirmations"`
117
  }
{/home/stefan/go/src/Polygon/zkevm-node → .}/aggregator/interfaces.go RENAMED
@@ -38,6 +38,7 @@
38
 
39
  // etherman contains the methods required to interact with ethereum
40
  type etherman interface {
 
41
  GetLatestVerifiedBatchNum() (uint64, error)
42
  BuildTrustedVerifyBatchesTxData(lastVerifiedBatch, newVerifiedBatch uint64, inputs *ethmanTypes.FinalProofInputs, beneficiary common.Address) (to *common.Address, data []byte, err error)
43
  GetLatestBlockHeader(ctx context.Context) (*types.Header, error)
 
38
 
39
  // etherman contains the methods required to interact with ethereum
40
  type etherman interface {
41
+ GetRollupId() uint32
42
  GetLatestVerifiedBatchNum() (uint64, error)
43
  BuildTrustedVerifyBatchesTxData(lastVerifiedBatch, newVerifiedBatch uint64, inputs *ethmanTypes.FinalProofInputs, beneficiary common.Address) (to *common.Address, data []byte, err error)
44
  GetLatestBlockHeader(ctx context.Context) (*types.Header, error)
{/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/approve.go RENAMED
@@ -51,14 +51,14 @@
51
  setupLog(c.Log)
52
 
53
  // Check if it is already registered
54
- etherman, err := newEtherman(*c)
55
  if err != nil {
56
  log.Fatal(err)
57
  return err
58
  }
59
 
60
  // load auth from keystore file
61
- auth, err := etherman.LoadAuthFromKeyStore(addrKeyStorePath, addrPassword)
62
  if err != nil {
63
  log.Fatal(err)
64
  return err
 
51
  setupLog(c.Log)
52
 
53
  // Check if it is already registered
54
+ etherman, err := newEtherman(*c, nil)
55
  if err != nil {
56
  log.Fatal(err)
57
  return err
58
  }
59
 
60
  // load auth from keystore file
61
+ auth, _, err := etherman.LoadAuthFromKeyStore(addrKeyStorePath, addrPassword)
62
  if err != nil {
63
  log.Fatal(err)
64
  return err
{/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/main.go RENAMED
@@ -47,7 +47,7 @@
47
  networkFlag = cli.StringFlag{
48
  Name: config.FlagNetwork,
49
  Aliases: []string{"net"},
50
- Usage: "Load default network configuration. Supported values: [`mainnet`, `testnet`, `cardona`, `custom`]",
51
  Required: true,
52
  }
53
  customNetworkFlag = cli.StringFlag{
@@ -186,6 +186,13 @@
186
  Action: restore,
187
  Flags: restoreFlags,
188
  },
 
 
 
 
 
 
 
189
  }
190
 
191
  err := app.Run(os.Args)
 
47
  networkFlag = cli.StringFlag{
48
  Name: config.FlagNetwork,
49
  Aliases: []string{"net"},
50
+ Usage: "Load default network configuration. Supported values: [`custom`]",
51
  Required: true,
52
  }
53
  customNetworkFlag = cli.StringFlag{
 
186
  Action: restore,
187
  Flags: restoreFlags,
188
  },
189
+ {
190
+ Name: "set-data-availability-protocol",
191
+ Aliases: []string{"set-dap"},
192
+ Usage: "Sets the new data availability protocol",
193
+ Action: setDataAvailabilityProtocol,
194
+ Flags: setDataAvailabilityProtocolFlags,
195
+ },
196
  }
197
 
198
  err := app.Run(os.Args)
{/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/policy.go RENAMED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package main
2
+
3
+ import (
4
+ "context"
5
+ "encoding/csv"
6
+ "errors"
7
+ "fmt"
8
+ "os"
9
+ "strings"
10
+
11
+ "github.com/0xPolygonHermez/zkevm-node/config"
12
+ "github.com/0xPolygonHermez/zkevm-node/pool"
13
+ "github.com/0xPolygonHermez/zkevm-node/pool/pgpoolstorage"
14
+ "github.com/ethereum/go-ethereum/common"
15
+ "github.com/urfave/cli/v2"
16
+ )
17
+
18
+ var (
19
+ policyFlag = cli.StringFlag{
20
+ Name: "policy",
21
+ Aliases: []string{"p"},
22
+ Usage: "Name of policy to operate on",
23
+ Required: false,
24
+ }
25
+ csvFlag = cli.StringFlag{
26
+ Name: "csv",
27
+ Usage: "CSV file with addresses",
28
+ Required: false,
29
+ }
30
+ allowFlag = cli.BoolFlag{
31
+ Name: "allow",
32
+ Usage: "Update policy to 'allow' addresses on list",
33
+ Required: false,
34
+ }
35
+ denyFlag = cli.BoolFlag{
36
+ Name: "deny",
37
+ Usage: "Update policy to 'deny' addresses on list",
38
+ Required: false,
39
+ }
40
+ noHeaderFlag = cli.BoolFlag{
41
+ Name: "no-header",
42
+ Value: false,
43
+ Required: false,
44
+ }
45
+
46
+ policyActionFlags = []cli.Flag{&policyFlag}
47
+ )
48
+
49
+ var policyCommands = cli.Command{
50
+ Name: "policy",
51
+ Usage: "View, update, and apply policies",
52
+ Action: describe,
53
+ Flags: []cli.Flag{&configFileFlag},
54
+ Subcommands: []*cli.Command{
55
+ {
56
+ Name: "add",
57
+ Usage: "Add address(es) to a policy exclusion list",
58
+ Action: addAcl,
59
+ Flags: append(policyActionFlags, &csvFlag),
60
+ }, {
61
+ Name: "clear",
62
+ Usage: "Clear the addresses listed as exceptions to a policy",
63
+ Action: clearAcl,
64
+ Flags: policyActionFlags,
65
+ }, {
66
+ Name: "describe",
67
+ Usage: "Describe the default actions for the policies",
68
+ Action: describe,
69
+ Flags: append(policyActionFlags, &noHeaderFlag),
70
+ }, {
71
+ Name: "remove",
72
+ Usage: "Remove address(es) from a policy exclusion list",
73
+ Action: removeAcl,
74
+ Flags: append(policyActionFlags, &csvFlag),
75
+ }, {
76
+ Name: "update",
77
+ Usage: "Update the default action for a policy",
78
+ Action: updatePolicy,
79
+ Flags: append(policyActionFlags, &allowFlag, &denyFlag),
80
+ },
81
+ },
82
+ }
83
+
84
+ func updatePolicy(cli *cli.Context) error {
85
+ _, db, err := configAndStorage(cli)
86
+ if err != nil {
87
+ return err
88
+ }
89
+ policy, err := resolvePolicy(cli)
90
+ if err != nil {
91
+ return err
92
+ }
93
+
94
+ allow := cli.Bool(allowFlag.Name)
95
+ deny := cli.Bool(denyFlag.Name)
96
+
97
+ // exactly one must be set
98
+ if (allow && deny) || (!allow && !deny) {
99
+ return errors.New("supply one policy action [--allow or --deny]")
100
+ }
101
+
102
+ var setting bool
103
+ if allow {
104
+ setting = true
105
+ } else if deny {
106
+ setting = false
107
+ }
108
+
109
+ err = db.UpdatePolicy(context.Background(), policy, setting)
110
+ if err != nil {
111
+ return err
112
+ }
113
+ return nil
114
+ }
115
+
116
+ func addAcl(cli *cli.Context) error {
117
+ _, db, err := configAndStorage(cli)
118
+ if err != nil {
119
+ return err
120
+ }
121
+ policy, addresses, err := requirePolicyAndAddresses(cli)
122
+ if err != nil {
123
+ return err
124
+ }
125
+ err = db.AddAddressesToPolicy(context.Background(), policy, addresses)
126
+ if err != nil {
127
+ return err
128
+ }
129
+ return nil
130
+ }
131
+
132
+ func removeAcl(cli *cli.Context) error {
133
+ _, db, err := configAndStorage(cli)
134
+ if err != nil {
135
+ return err
136
+ }
137
+ policy, addresses, err := requirePolicyAndAddresses(cli)
138
+ if err != nil {
139
+ return err
140
+ }
141
+ err = db.RemoveAddressesFromPolicy(context.Background(), policy, addresses)
142
+ if err != nil {
143
+ return err
144
+ }
145
+ return nil
146
+ }
147
+
148
+ func clearAcl(cli *cli.Context) error {
149
+ _, db, err := configAndStorage(cli)
150
+ if err != nil {
151
+ return err
152
+ }
153
+ policy, err := resolvePolicy(cli)
154
+ if err != nil {
155
+ return err
156
+ }
157
+ err = db.ClearPolicy(context.Background(), policy)
158
+ if err != nil {
159
+ return err
160
+ }
161
+ return nil
162
+ }
163
+
164
+ func describe(cli *cli.Context) error {
165
+ showHeader := !cli.Bool(noHeaderFlag.Name)
166
+ if cli.IsSet(policyFlag.Name) {
167
+ return describePolicy(cli, showHeader)
168
+ }
169
+ return describePolicies(cli, showHeader)
170
+ }
171
+
172
+ func describePolicy(cli *cli.Context, showHeader bool) error {
173
+ _, db, err := configAndStorage(cli)
174
+ if err != nil {
175
+ return err
176
+ }
177
+
178
+ policyName, err := resolvePolicy(cli)
179
+ if err != nil {
180
+ return err
181
+ }
182
+
183
+ if showHeader {
184
+ policy, err := db.DescribePolicy(context.Background(), policyName)
185
+ if err != nil {
186
+ return err
187
+ }
188
+ fmt.Printf("%s: %s\n", "Policy", policy.Name)
189
+ fmt.Printf("%s: %s\n", "Action", policy.Desc())
190
+ }
191
+ query, err := resolveAddresses(cli, false)
192
+ if err != nil {
193
+ return nil
194
+ }
195
+ list, err := db.ListAcl(context.Background(), policyName, query)
196
+ if err != nil {
197
+ return err
198
+ }
199
+
200
+ if showHeader {
201
+ fmt.Println("Addresses:")
202
+ }
203
+ for _, address := range list {
204
+ fmt.Println(address.Hex())
205
+ }
206
+ return nil
207
+ }
208
+
209
+ func describePolicies(cli *cli.Context, showHeader bool) error {
210
+ _, db, err := configAndStorage(cli)
211
+ if err != nil {
212
+ return err
213
+ }
214
+ list, err := db.DescribePolicies(context.Background())
215
+ if err != nil {
216
+ return err
217
+ }
218
+
219
+ if showHeader {
220
+ fmt.Printf("%7s: %s\n", "Policy", "Action")
221
+ }
222
+ for _, p := range list {
223
+ fmt.Printf("%7s: %s\n", p.Name, p.Desc())
224
+ }
225
+
226
+ return nil
227
+ }
228
+
229
+ func configAndStorage(cli *cli.Context) (*config.Config, *pgpoolstorage.PostgresPoolStorage, error) {
230
+ c, err := config.Load(cli, false)
231
+ if err != nil {
232
+ return nil, nil, err
233
+ }
234
+ setupLog(c.Log)
235
+
236
+ db, err := pgpoolstorage.NewPostgresPoolStorage(c.Pool.DB)
237
+ if err != nil {
238
+ return nil, nil, err
239
+ }
240
+ return c, db, nil
241
+ }
242
+
243
+ func requirePolicyAndAddresses(cli *cli.Context) (pool.PolicyName, []common.Address, error) {
244
+ policy, err := resolvePolicy(cli)
245
+ if err != nil {
246
+ return "", nil, err
247
+ }
248
+ addresses, err := resolveAddresses(cli, true)
249
+ if err != nil {
250
+ return "", nil, err
251
+ }
252
+ return policy, addresses, nil
253
+ }
254
+
255
+ func resolvePolicy(cli *cli.Context) (pool.PolicyName, error) {
256
+ policy := cli.String(policyFlag.Name)
257
+ if policy == "" {
258
+ return "", nil
259
+ }
260
+ if !pool.IsPolicy(policy) {
261
+ return "", fmt.Errorf("invalid policy name: %s", policy)
262
+ }
263
+ return pool.PolicyName(policy), nil
264
+ }
265
+
266
+ func resolveAddresses(cli *cli.Context, failIfEmpty bool) ([]common.Address, error) {
267
+ var set = make(map[common.Address]struct{})
268
+ if cli.IsSet("csv") {
269
+ file := cli.String(csvFlag.Name)
270
+ fd, err := os.Open(file)
271
+ if err != nil {
272
+ return nil, err
273
+ }
274
+ defer func(fd *os.File) {
275
+ _ = fd.Close()
276
+ }(fd)
277
+
278
+ fileReader := csv.NewReader(fd)
279
+ records, err := fileReader.ReadAll()
280
+
281
+ if err != nil {
282
+ return nil, err
283
+ }
284
+ for _, row := range records {
285
+ for _, cell := range row {
286
+ hex := strings.TrimSpace(cell)
287
+ set[common.HexToAddress(hex)] = struct{}{}
288
+ }
289
+ }
290
+ }
291
+
292
+ for _, a := range cli.Args().Slice() {
293
+ a = strings.TrimSpace(a)
294
+ a = strings.Trim(a, ",|")
295
+ if !strings.HasPrefix(a, "0x") {
296
+ a = "0x" + a
297
+ }
298
+ set[common.HexToAddress(a)] = struct{}{}
299
+ }
300
+ var ret []common.Address
301
+ for a := range set {
302
+ ret = append(ret, a)
303
+ }
304
+ if failIfEmpty && len(ret) == 0 {
305
+ return nil, errors.New("no addresses given")
306
+ }
307
+ return ret, nil
308
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/run.go RENAMED
@@ -2,6 +2,7 @@
2
 
3
  import (
4
  "context"
 
5
  "errors"
6
  "fmt"
7
  "net"
@@ -107,19 +112,27 @@
107
  log.Fatal(err)
108
  }
109
 
110
- etherman, err := newEtherman(*c)
 
111
  if err != nil {
112
  log.Fatal(err)
113
  }
114
-
115
- // READ CHAIN ID FROM POE SC
116
- l2ChainID, err := etherman.GetL2ChainID()
117
  if err != nil {
118
  log.Fatal(err)
119
  }
120
 
 
 
 
 
121
  st, currentForkID := newState(cliCtx.Context, c, etherman, l2ChainID, stateSqlDB, eventLog, needsExecutor, needsStateTree, false)
122
 
 
 
 
 
 
123
  c.Aggregator.ChainID = l2ChainID
124
  c.Sequencer.StreamServer.ChainID = l2ChainID
125
  log.Infof("Chain ID read from POE SC = %v", l2ChainID)
@@ -276,8 +289,79 @@
276
  }
277
  }
278
 
279
- func newEtherman(c config.Config) (*etherman.Client, error) {
280
- return etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
  }
282
 
283
  func runSynchronizer(cfg config.Config, etherman *etherman.Client, ethTxManagerStorage *ethtxmanager.PostgresStorage, st *state.State, pool *pool.Pool, eventLog *event.EventLog) {
@@ -301,7 +385,7 @@
301
  // If synchronizer are using sequential mode, we only need one etherman client
302
  if cfg.Synchronizer.L1SynchronizationMode == synchronizer.ParallelMode {
303
  for i := 0; i < int(cfg.Synchronizer.L1ParallelSynchronization.MaxClients+1); i++ {
304
- eth, err := newEtherman(cfg)
305
  if err != nil {
306
  log.Fatal(err)
307
  }
@@ -404,12 +488,12 @@
404
  }
405
 
406
  func createSequenceSender(cfg config.Config, pool *pool.Pool, etmStorage *ethtxmanager.PostgresStorage, st *state.State, eventLog *event.EventLog) *sequencesender.SequenceSender {
407
- etherman, err := newEtherman(cfg)
408
  if err != nil {
409
  log.Fatal(err)
410
  }
411
 
412
- auth, err := etherman.LoadAuthFromKeyStore(cfg.SequenceSender.PrivateKey.Path, cfg.SequenceSender.PrivateKey.Password)
413
  if err != nil {
414
  log.Fatal(err)
415
  }
@@ -419,7 +503,12 @@
419
 
420
  ethTxManager := ethtxmanager.New(cfg.EthTxManager, etherman, etmStorage, st)
421
 
422
- seqSender, err := sequencesender.New(cfg.SequenceSender, st, etherman, ethTxManager, eventLog)
 
 
 
 
 
423
  if err != nil {
424
  log.Fatal(err)
425
  }
@@ -428,7 +517,23 @@
428
  }
429
 
430
  func runAggregator(ctx context.Context, c aggregator.Config, etherman *etherman.Client, ethTxManager *ethtxmanager.Client, st *state.State) {
431
- agg, err := aggregator.New(c, st, ethTxManager, etherman)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
432
  if err != nil {
433
  log.Fatal(err)
434
  }
@@ -490,16 +595,15 @@
490
  AvoidForkIDInMemory: avoidForkIDInMemory,
491
  }
492
  stateDb := pgstatestorage.NewPostgresStorage(stateCfg, sqlDB)
493
-
494
  st := state.NewState(stateCfg, stateDb, executorClient, stateTree, eventLog, nil)
495
  // This is to force to build cache, and check that DB is ok before starting the application
496
- l1InfoRoot, err := st.GetCurrentL1InfoRoot(ctx, nil)
497
  if err != nil {
498
  log.Fatal("error getting current L1InfoRoot. Error: ", err)
499
  }
500
- log.Infof("Starting L1InfoRoot: %v", l1InfoRoot.String())
501
 
502
- forkIDIntervals, err := forkIDIntervals(ctx, st, etherman, c.NetworkConfig.Genesis.BlockNumber)
503
  if err != nil {
504
  log.Fatal("error getting forkIDs. Error: ", err)
505
  }
@@ -522,13 +626,13 @@
522
  }
523
 
524
  func createEthTxManager(cfg config.Config, etmStorage *ethtxmanager.PostgresStorage, st *state.State) *ethtxmanager.Client {
525
- etherman, err := newEtherman(cfg)
526
  if err != nil {
527
  log.Fatal(err)
528
  }
529
 
530
  for _, privateKey := range cfg.EthTxManager.PrivateKeys {
531
- _, err := etherman.LoadAuthFromKeyStore(privateKey.Path, privateKey.Password)
532
  if err != nil {
533
  log.Fatal(err)
534
  }
 
2
 
3
  import (
4
  "context"
5
+ "crypto/ecdsa"
6
  "errors"
7
  "fmt"
8
  "net"
 
112
  log.Fatal(err)
113
  }
114
 
115
+ // READ CHAIN ID FROM POE SC
116
+ tmpEthMan, err := etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config, nil)
117
  if err != nil {
118
  log.Fatal(err)
119
  }
120
+ l2ChainID, err := tmpEthMan.GetL2ChainID()
 
 
121
  if err != nil {
122
  log.Fatal(err)
123
  }
124
 
125
+ etherman, err := etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config, nil)
126
+ if err != nil {
127
+ log.Fatal(err)
128
+ }
129
  st, currentForkID := newState(cliCtx.Context, c, etherman, l2ChainID, stateSqlDB, eventLog, needsExecutor, needsStateTree, false)
130
 
131
+ etherman, err = newEtherman(*c, st)
132
+ if err != nil {
133
+ log.Fatal(err)
134
+ }
135
+
136
  c.Aggregator.ChainID = l2ChainID
137
  c.Sequencer.StreamServer.ChainID = l2ChainID
138
  log.Infof("Chain ID read from POE SC = %v", l2ChainID)
 
289
  }
290
  }
291
 
292
+ func newEtherman(c config.Config, st *state.State) (*etherman.Client, error) {
293
+ ethman, err := etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config, nil)
294
+ if err != nil {
295
+ return nil, err
296
+ }
297
+ da, err := newDataAvailability(c, st, ethman, false)
298
+ if err != nil {
299
+ return nil, err
300
+ }
301
+ return etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config, da)
302
+ }
303
+
304
+ func newDataAvailability(c config.Config, st *state.State, etherman *etherman.Client, isSequenceSender bool) (*dataavailability.DataAvailability, error) {
305
+ var (
306
+ trustedSequencerURL string
307
+ err error
308
+ )
309
+ if !c.IsTrustedSequencer {
310
+ if c.Synchronizer.TrustedSequencerURL != "" {
311
+ trustedSequencerURL = c.Synchronizer.TrustedSequencerURL
312
+ } else {
313
+ log.Debug("getting trusted sequencer URL from smc")
314
+ trustedSequencerURL, err = etherman.GetTrustedSequencerURL()
315
+ if err != nil {
316
+ return nil, fmt.Errorf("error getting trusted sequencer URI. Error: %v", err)
317
+ }
318
+ }
319
+ log.Debug("trustedSequencerURL ", trustedSequencerURL)
320
+ }
321
+ zkEVMClient := client.NewClient(trustedSequencerURL)
322
+
323
+ // Backend specific config
324
+ daProtocolName, err := etherman.GetDAProtocolName()
325
+ if err != nil {
326
+ return nil, fmt.Errorf("error getting data availability protocol name: %v", err)
327
+ }
328
+ var daBackend dataavailability.DABackender
329
+ switch daProtocolName {
330
+ case string(dataavailability.DataAvailabilityCommittee):
331
+ var (
332
+ pk *ecdsa.PrivateKey
333
+ err error
334
+ )
335
+ if isSequenceSender {
336
+ _, pk, err = etherman.LoadAuthFromKeyStore(c.SequenceSender.PrivateKey.Path, c.SequenceSender.PrivateKey.Password)
337
+ if err != nil {
338
+ return nil, err
339
+ }
340
+ }
341
+ dacAddr, err := etherman.GetDAProtocolAddr()
342
+ if err != nil {
343
+ return nil, fmt.Errorf("error getting trusted sequencer URI. Error: %v", err)
344
+ }
345
+
346
+ daBackend, err = datacommittee.New(
347
+ c.Etherman.URL,
348
+ dacAddr,
349
+ pk,
350
+ dataCommitteeClient.NewFactory(),
351
+ )
352
+ if err != nil {
353
+ return nil, err
354
+ }
355
+ default:
356
+ return nil, fmt.Errorf("unexpected / unsupported DA protocol: %s", daProtocolName)
357
+ }
358
+
359
+ return dataavailability.New(
360
+ c.IsTrustedSequencer,
361
+ daBackend,
362
+ st,
363
+ zkEVMClient,
364
+ )
365
  }
366
 
367
  func runSynchronizer(cfg config.Config, etherman *etherman.Client, ethTxManagerStorage *ethtxmanager.PostgresStorage, st *state.State, pool *pool.Pool, eventLog *event.EventLog) {
 
385
  // If synchronizer are using sequential mode, we only need one etherman client
386
  if cfg.Synchronizer.L1SynchronizationMode == synchronizer.ParallelMode {
387
  for i := 0; i < int(cfg.Synchronizer.L1ParallelSynchronization.MaxClients+1); i++ {
388
+ eth, err := newEtherman(cfg, st)
389
  if err != nil {
390
  log.Fatal(err)
391
  }
 
488
  }
489
 
490
  func createSequenceSender(cfg config.Config, pool *pool.Pool, etmStorage *ethtxmanager.PostgresStorage, st *state.State, eventLog *event.EventLog) *sequencesender.SequenceSender {
491
+ etherman, err := newEtherman(cfg, st)
492
  if err != nil {
493
  log.Fatal(err)
494
  }
495
 
496
+ auth, _, err := etherman.LoadAuthFromKeyStore(cfg.SequenceSender.PrivateKey.Path, cfg.SequenceSender.PrivateKey.Password)
497
  if err != nil {
498
  log.Fatal(err)
499
  }
 
503
 
504
  ethTxManager := ethtxmanager.New(cfg.EthTxManager, etherman, etmStorage, st)
505
 
506
+ da, err := newDataAvailability(cfg, st, etherman, true)
507
+ if err != nil {
508
+ log.Fatal(err)
509
+ }
510
+
511
+ seqSender, err := sequencesender.New(cfg.SequenceSender, st, etherman, ethTxManager, eventLog, da)
512
  if err != nil {
513
  log.Fatal(err)
514
  }
 
517
  }
518
 
519
  func runAggregator(ctx context.Context, c aggregator.Config, etherman *etherman.Client, ethTxManager *ethtxmanager.Client, st *state.State) {
520
+ var (
521
+ aggCli *agglayerClient.Client
522
+ pk *ecdsa.PrivateKey
523
+ err error
524
+ )
525
+
526
+ if c.SettlementBackend == aggregator.AggLayer {
527
+ aggCli = agglayerClient.New(c.AggLayerURL)
528
+
529
+ // Load private key
530
+ pk, err = config.NewKeyFromKeystore(c.SequencerPrivateKey)
531
+ if err != nil {
532
+ log.Fatal(err)
533
+ }
534
+ }
535
+
536
+ agg, err := aggregator.New(c, st, ethTxManager, etherman, aggCli, pk)
537
  if err != nil {
538
  log.Fatal(err)
539
  }
 
595
  AvoidForkIDInMemory: avoidForkIDInMemory,
596
  }
597
  stateDb := pgstatestorage.NewPostgresStorage(stateCfg, sqlDB)
 
598
  st := state.NewState(stateCfg, stateDb, executorClient, stateTree, eventLog, nil)
599
  // This is to force to build cache, and check that DB is ok before starting the application
600
+ l1inforoot, err := st.GetCurrentL1InfoRoot(ctx, nil)
601
  if err != nil {
602
  log.Fatal("error getting current L1InfoRoot. Error: ", err)
603
  }
604
+ log.Infof("Starting L1InfoRoot: %v", l1inforoot.String())
605
 
606
+ forkIDIntervals, err := forkIDIntervals(ctx, st, etherman, c.NetworkConfig.Genesis.RollupBlockNumber)
607
  if err != nil {
608
  log.Fatal("error getting forkIDs. Error: ", err)
609
  }
 
626
  }
627
 
628
  func createEthTxManager(cfg config.Config, etmStorage *ethtxmanager.PostgresStorage, st *state.State) *ethtxmanager.Client {
629
+ etherman, err := newEtherman(cfg, st)
630
  if err != nil {
631
  log.Fatal(err)
632
  }
633
 
634
  for _, privateKey := range cfg.EthTxManager.PrivateKeys {
635
+ _, _, err := etherman.LoadAuthFromKeyStore(privateKey.Path, privateKey.Password)
636
  if err != nil {
637
  log.Fatal(err)
638
  }
{/home/stefan/go/src/Polygon/zkevm-node → .}/cmd/set_data_availability_protocol.go RENAMED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package main
2
+
3
+ import (
4
+ "github.com/0xPolygonHermez/zkevm-node/config"
5
+ "github.com/0xPolygonHermez/zkevm-node/log"
6
+ "github.com/ethereum/go-ethereum/common"
7
+ "github.com/urfave/cli/v2"
8
+ )
9
+
10
+ const flagDAAddress = "data-availability-address"
11
+
12
+ var setDataAvailabilityProtocolFlags = []cli.Flag{
13
+ &cli.StringFlag{
14
+ Name: flagDAAddress,
15
+ Aliases: []string{"da-addr"},
16
+ Usage: "address of the new data availibility protocol",
17
+ Required: true,
18
+ },
19
+ &cli.StringFlag{
20
+ Name: config.FlagKeyStorePath,
21
+ Aliases: []string{"ksp"},
22
+ Usage: "the path of the key store file containing the private key of the account going to set new data availability protocol",
23
+ Required: true,
24
+ },
25
+ &cli.StringFlag{
26
+ Name: config.FlagPassword,
27
+ Aliases: []string{"pw"},
28
+ Usage: "the password do decrypt the key store file",
29
+ Required: true,
30
+ },
31
+ &configFileFlag,
32
+ &networkFlag,
33
+ &customNetworkFlag,
34
+ }
35
+
36
+ func setDataAvailabilityProtocol(ctx *cli.Context) error {
37
+ c, err := config.Load(ctx, true)
38
+ if err != nil {
39
+ return err
40
+ }
41
+
42
+ setupLog(c.Log)
43
+
44
+ daAddress := common.HexToAddress(ctx.String(flagDAAddress))
45
+ addrKeyStorePath := ctx.String(config.FlagKeyStorePath)
46
+ addrPassword := ctx.String(config.FlagPassword)
47
+
48
+ etherman, err := newEtherman(*c, nil)
49
+ if err != nil {
50
+ log.Fatal(err)
51
+ return err
52
+ }
53
+
54
+ auth, _, err := etherman.LoadAuthFromKeyStore(addrKeyStorePath, addrPassword)
55
+ if err != nil {
56
+ log.Fatal(err)
57
+ return err
58
+ }
59
+
60
+ tx, err := etherman.SetDataAvailabilityProtocol(auth.From, daAddress)
61
+ if err != nil {
62
+ return err
63
+ }
64
+
65
+ log.Infof("Transaction to set new data availability protocol sent. Hash: %s", tx.Hash())
66
+
67
+ return nil
68
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/config/cardonagenesis.go RENAMED
@@ -1,109 +0,0 @@
1
- package config
2
-
3
- // CardonaNetworkConfigJSON is the hardcoded network configuration to be used for the official mainnet setup
4
- const CardonaNetworkConfigJSON = `
5
- {
6
- "l1Config": {
7
- "polygonZkEVMAddress": "0xA13Ddb14437A8F34897131367ad3ca78416d6bCa",
8
- "polygonZkEVMBridgeAddress": "0x528e26b25a34a4A5d0dbDa1d57D318153d2ED582",
9
- "polygonZkEVMGlobalExitRootAddress": "0xAd1490c248c5d3CbAE399Fd529b79B42984277DF",
10
- "polTokenAddress": "0x6a7c3F4B0651d6DA389AD1d11D962ea458cDCA70",
11
- "polygonRollupManagerAddress": "0x32d33D5137a7cFFb54c5Bf8371172bcEc5f310ff",
12
- "chainId": 11155111
13
- },
14
- "genesisBlockNumber": 4789190,
15
- "root": "0x91dfcdeb628dfdc51f3a2ee38cb17c78581e4e7ff91bcc2e327d24a9dfa46982",
16
- "genesis": [
17
- {
18
- "contractName": "PolygonZkEVMDeployer",
19
- "balance": "0",
20
- "nonce": "4",
21
- "address": "0x36810012486fc134D0679c07f85fe5ba5A087D8C",
22
- "bytecode": "0x6080604052600436106100705760003560e01c8063715018a61161004e578063715018a6146100e65780638da5cb5b146100fb578063e11ae6cb14610126578063f2fde38b1461013957600080fd5b80632b79805a146100755780634a94d4871461008a5780636d07dbf81461009d575b600080fd5b610088610083366004610927565b610159565b005b6100886100983660046109c7565b6101cb565b3480156100a957600080fd5b506100bd6100b8366004610a1e565b61020d565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b50610088610220565b34801561010757600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100bd565b610088610134366004610a40565b610234565b34801561014557600080fd5b50610088610154366004610a90565b61029b565b610161610357565b600061016e8585856103d8565b905061017a8183610537565b5060405173ffffffffffffffffffffffffffffffffffffffff821681527fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a15050505050565b6101d3610357565b6101de83838361057b565b506040517f25adb19089b6a549831a273acdf7908cff8b7ee5f551f8d1d37996cf01c5df5b90600090a1505050565b600061021983836105a9565b9392505050565b610228610357565b61023260006105b6565b565b61023c610357565b60006102498484846103d8565b60405173ffffffffffffffffffffffffffffffffffffffff821681529091507fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a150505050565b6102a3610357565b73ffffffffffffffffffffffffffffffffffffffff811661034b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610354816105b6565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610232576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610342565b600083471015610444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e63650000006044820152606401610342565b81516000036104af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152606401610342565b8282516020840186f5905073ffffffffffffffffffffffffffffffffffffffff8116610219576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152606401610342565b6060610219838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c6564000081525061062b565b60606105a1848484604051806060016040528060298152602001610b3d6029913961062b565b949350505050565b6000610219838330610744565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060824710156106bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610342565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516106e69190610acf565b60006040518083038185875af1925050503d8060008114610723576040519150601f19603f3d011682016040523d82523d6000602084013e610728565b606091505b50915091506107398783838761076e565b979650505050505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b606083156108045782516000036107fd5773ffffffffffffffffffffffffffffffffffffffff85163b6107fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610342565b50816105a1565b6105a183838151156108195781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103429190610aeb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261088d57600080fd5b813567ffffffffffffffff808211156108a8576108a861084d565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156108ee576108ee61084d565b8160405283815286602085880101111561090757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806080858703121561093d57600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561096357600080fd5b61096f8883890161087c565b9350606087013591508082111561098557600080fd5b506109928782880161087c565b91505092959194509250565b803573ffffffffffffffffffffffffffffffffffffffff811681146109c257600080fd5b919050565b6000806000606084860312156109dc57600080fd5b6109e58461099e565b9250602084013567ffffffffffffffff811115610a0157600080fd5b610a0d8682870161087c565b925050604084013590509250925092565b60008060408385031215610a3157600080fd5b50508035926020909101359150565b600080600060608486031215610a5557600080fd5b8335925060208401359150604084013567ffffffffffffffff811115610a7a57600080fd5b610a868682870161087c565b9150509250925092565b600060208284031215610aa257600080fd5b6102198261099e565b60005b83811015610ac6578181015183820152602001610aae565b50506000910152565b60008251610ae1818460208701610aab565b9190910192915050565b6020815260008251806020840152610b0a816040850160208701610aab565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a26469706673582212203e70ce334e8ec9d8d03e87415afd36dce4e82633bd277b08937095a6bd66367764736f6c63430008110033",
23
- "storage": {
24
- "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000ff6250d0e86a2465b0c1bf8e36409503d6a26963"
25
- }
26
- },
27
- {
28
- "contractName": "ProxyAdmin",
29
- "balance": "0",
30
- "nonce": "1",
31
- "address": "0x85cEB41028B1a5ED2b88E395145344837308b251",
32
- "bytecode": "0x60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461012b57806399a88ec41461013e578063f2fde38b1461015e578063f3b7dead1461017e57600080fd5b8063204e1c7a14610080578063715018a6146100c95780637eff275e146100e05780638da5cb5b14610100575b600080fd5b34801561008c57600080fd5b506100a061009b366004610608565b61019e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100d557600080fd5b506100de610255565b005b3480156100ec57600080fd5b506100de6100fb36600461062c565b610269565b34801561010c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100a0565b6100de610139366004610694565b6102f7565b34801561014a57600080fd5b506100de61015936600461062c565b61038c565b34801561016a57600080fd5b506100de610179366004610608565b6103e8565b34801561018a57600080fd5b506100a0610199366004610608565b6104a4565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907f5c60da1b00000000000000000000000000000000000000000000000000000000815260040190565b600060405180830381855afa9150503d8060008114610225576040519150601f19603f3d011682016040523d82523d6000602084013e61022a565b606091505b50915091508161023957600080fd5b8080602001905181019061024d9190610788565b949350505050565b61025d6104f0565b6102676000610571565b565b6102716104f0565b6040517f8f28397000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690638f283970906024015b600060405180830381600087803b1580156102db57600080fd5b505af11580156102ef573d6000803e3d6000fd5b505050505050565b6102ff6104f0565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef28690349061035590869086906004016107a5565b6000604051808303818588803b15801561036e57600080fd5b505af1158015610382573d6000803e3d6000fd5b5050505050505050565b6103946104f0565b6040517f3659cfe600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690633659cfe6906024016102c1565b6103f06104f0565b73ffffffffffffffffffffffffffffffffffffffff8116610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6104a181610571565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907ff851a44000000000000000000000000000000000000000000000000000000000815260040190565b60005473ffffffffffffffffffffffffffffffffffffffff163314610267576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161048f565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff811681146104a157600080fd5b60006020828403121561061a57600080fd5b8135610625816105e6565b9392505050565b6000806040838503121561063f57600080fd5b823561064a816105e6565b9150602083013561065a816105e6565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156106a957600080fd5b83356106b4816105e6565b925060208401356106c4816105e6565b9150604084013567ffffffffffffffff808211156106e157600080fd5b818601915086601f8301126106f557600080fd5b81358181111561070757610707610665565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561074d5761074d610665565b8160405282815289602084870101111561076657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60006020828403121561079a57600080fd5b8151610625816105e6565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b818110156107ef578581018301518582016060015282016107d3565b5060006060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010192505050939250505056fea2646970667358221220372a0e10eebea1b7fa43ae4c976994e6ed01d85eedc3637b83f01d3f06be442064736f6c63430008110033",
33
- "storage": {
34
- "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000dbc6981a11fc2b000c635bfa7c47676b25c87d39"
35
- }
36
- },
37
- {
38
- "contractName": "PolygonZkEVMBridge implementation",
39
- "balance": "0",
40
- "nonce": "1",
41
- "address": "0x8BD36ca1A55e389335004872aA3C3Be0969D3aA7",
42
- "bytecode": "0x6080604052600436106200019f5760003560e01c8063647c576c11620000e7578063be5831c71162000089578063dbc169761162000060578063dbc169761462000639578063ee25560b1462000651578063fb570834146200068257600080fd5b8063be5831c714620005ae578063cd58657914620005ea578063d02103ca146200060157600080fd5b80639e34070f11620000be5780639e34070f146200050a578063aaa13cc2146200054f578063bab161bf146200057457600080fd5b8063647c576c146200048657806379e2cf9714620004ab57806381b1c17414620004c357600080fd5b80632d2c9d94116200015157806334ac9cf2116200012857806334ac9cf2146200034b5780633ae05047146200037a5780633e197043146200039257600080fd5b80632d2c9d9414620002765780632dfdf0b5146200029b578063318aee3d14620002c257600080fd5b806322e95f2c116200018657806322e95f2c14620001ef578063240ff378146200023a5780632cffd02e146200025157600080fd5b806315064c9614620001a45780632072f6c514620001d5575b600080fd5b348015620001b157600080fd5b50606854620001c09060ff1681565b60405190151581526020015b60405180910390f35b348015620001e257600080fd5b50620001ed620006a7565b005b348015620001fc57600080fd5b50620002146200020e366004620032db565b62000705565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001620001cc565b620001ed6200024b36600462003372565b620007a8565b3480156200025e57600080fd5b50620001ed6200027036600462003409565b620009d0565b3480156200028357600080fd5b50620001ed6200029536600462003409565b62000f74565b348015620002a857600080fd5b50620002b360535481565b604051908152602001620001cc565b348015620002cf57600080fd5b5062000319620002e1366004620034ef565b606b6020526000908152604090205463ffffffff811690640100000000900473ffffffffffffffffffffffffffffffffffffffff1682565b6040805163ffffffff909316835273ffffffffffffffffffffffffffffffffffffffff909116602083015201620001cc565b3480156200035857600080fd5b50606c54620002149073ffffffffffffffffffffffffffffffffffffffff1681565b3480156200038757600080fd5b50620002b362001178565b3480156200039f57600080fd5b50620002b3620003b136600462003526565b6040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b3480156200049357600080fd5b50620001ed620004a5366004620035b0565b6200125e565b348015620004b857600080fd5b50620001ed620014ad565b348015620004d057600080fd5b5062000214620004e236600462003600565b606a6020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200051757600080fd5b50620001c06200052936600462003600565b600881901c600090815260696020526040902054600160ff9092169190911b9081161490565b3480156200055c57600080fd5b50620002146200056e3660046200361a565b620014e7565b3480156200058157600080fd5b506068546200059890610100900463ffffffff1681565b60405163ffffffff9091168152602001620001cc565b348015620005bb57600080fd5b506068546200059890790100000000000000000000000000000000000000000000000000900463ffffffff1681565b620001ed620005fb366004620036ce565b620016d3565b3480156200060e57600080fd5b50606854620002149065010000000000900473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200064657600080fd5b50620001ed62001c37565b3480156200065e57600080fd5b50620002b36200067036600462003600565b60696020526000908152604090205481565b3480156200068f57600080fd5b50620001c0620006a136600462003770565b62001c93565b606c5473ffffffffffffffffffffffffffffffffffffffff163314620006f9576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362001d7c565b565b6040805160e084901b7fffffffff0000000000000000000000000000000000000000000000000000000016602080830191909152606084901b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602483015282516018818403018152603890920183528151918101919091206000908152606a909152205473ffffffffffffffffffffffffffffffffffffffff165b92915050565b60685460ff1615620007e6576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff8681166101009092041614806200080c5750600263ffffffff861610155b1562000844576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b6001606860019054906101000a900463ffffffff163388883488886053546040516200089a9998979695949392919062003806565b60405180910390a1620009b8620009b26001606860019054906101000a900463ffffffff16338989348989604051620008d592919062003881565b60405180910390206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b62001e10565b8215620009c957620009c962001f27565b5050505050565b60685460ff161562000a0e576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000a258b8b8b8b8b8b8b8b8b8b8b600062001ffc565b73ffffffffffffffffffffffffffffffffffffffff861662000b01576040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff861690859060405162000a7a9190620038e6565b60006040518083038185875af1925050503d806000811462000ab9576040519150601f19603f3d011682016040523d82523d6000602084013e62000abe565b606091505b505090508062000afa576040517f6747a28800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5062000efc565b60685463ffffffff61010090910481169088160362000b435762000b3d73ffffffffffffffffffffffffffffffffffffffff87168585620021ed565b62000efc565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b166024820152600090603801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000818152606a90935291205490915073ffffffffffffffffffffffffffffffffffffffff168062000e6e576000808062000c1886880188620039fb565b92509250925060008584848460405162000c329062003292565b62000c409392919062003abd565b8190604051809103906000f590508015801562000c61573d6000803e3d6000fd5b506040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c81166004830152602482018c9052919250908216906340c10f1990604401600060405180830381600087803b15801562000cd757600080fd5b505af115801562000cec573d6000803e3d6000fd5b5050505080606a600088815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060405180604001604052808e63ffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff16815250606b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050507f490e59a1701b938786ac72570a1efeac994a3dbe96e2e883e19e902ace6e6a398d8d838b8b60405162000e5c95949392919062003afa565b60405180910390a15050505062000ef9565b6040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018790528216906340c10f1990604401600060405180830381600087803b15801562000edf57600080fd5b505af115801562000ef4573d6000803e3d6000fd5b505050505b50505b6040805163ffffffff8c811682528916602082015273ffffffffffffffffffffffffffffffffffffffff88811682840152861660608201526080810185905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a15050505050505050505050565b60685460ff161562000fb2576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000fc98b8b8b8b8b8b8b8b8b8b8b600162001ffc565b60008473ffffffffffffffffffffffffffffffffffffffff1684888a868660405160240162000ffc949392919062003b42565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1806b5f200000000000000000000000000000000000000000000000000000000179052516200107f9190620038e6565b60006040518083038185875af1925050503d8060008114620010be576040519150601f19603f3d011682016040523d82523d6000602084013e620010c3565b606091505b5050905080620010ff576040517f37e391c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805163ffffffff8d811682528a16602082015273ffffffffffffffffffffffffffffffffffffffff89811682840152871660608201526080810186905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a1505050505050505050505050565b605354600090819081805b602081101562001255578083901c600116600103620011e65760338160208110620011b257620011b262003b8a565b0154604080516020810192909252810185905260600160405160208183030381529060405280519060200120935062001213565b60408051602081018690529081018390526060016040516020818303038152906040528051906020012093505b604080516020810184905290810183905260600160405160208183030381529060405280519060200120915080806200124c9062003be8565b91505062001183565b50919392505050565b600054610100900460ff16158080156200127f5750600054600160ff909116105b806200129b5750303b1580156200129b575060005460ff166001145b6200132d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156200138c57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b606880547fffffffffffffff000000000000000000000000000000000000000000000000ff1661010063ffffffff8716027fffffffffffffff0000000000000000000000000000000000000000ffffffffff16176501000000000073ffffffffffffffffffffffffffffffffffffffff8681169190910291909117909155606c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001691841691909117905562001443620022c3565b8015620014a757600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b605354606854790100000000000000000000000000000000000000000000000000900463ffffffff16101562000703576200070362001f27565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b1660248201526000908190603801604051602081830303815290604052805190602001209050600060ff60f81b3083604051806020016200157d9062003292565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820381018352601f909101166040819052620015c8908d908d908d908d908d9060200162003c23565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905262001606929160200162003c64565b604051602081830303815290604052805190602001206040516020016200168f94939291907fff0000000000000000000000000000000000000000000000000000000000000094909416845260609290921b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660018401526015830152603582015260550190565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815291905280516020909101209a9950505050505050505050565b60685460ff161562001711576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200171b62002366565b60685463ffffffff888116610100909204161480620017415750600263ffffffff881610155b1562001779576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060608773ffffffffffffffffffffffffffffffffffffffff8816620017df57883414620017d5576040517fb89240f500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000925062001ad9565b341562001818576040517f798ee6f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8089166000908152606b602090815260409182902082518084019093525463ffffffff811683526401000000009004909216918101829052901562001908576040517f9dc29fac000000000000000000000000000000000000000000000000000000008152336004820152602481018b905273ffffffffffffffffffffffffffffffffffffffff8a1690639dc29fac90604401600060405180830381600087803b158015620018db57600080fd5b505af1158015620018f0573d6000803e3d6000fd5b50505050806020015194508060000151935062001ad7565b85156200191d576200191d898b8989620023db565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8b16906370a0823190602401602060405180830381865afa1580156200198b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620019b1919062003c97565b9050620019d773ffffffffffffffffffffffffffffffffffffffff8b1633308e620028f9565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa15801562001a45573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001a6b919062003c97565b905062001a79828262003cb1565b6068548c9850610100900463ffffffff169650935062001a998762002959565b62001aa48c62002a71565b62001aaf8d62002b7e565b60405160200162001ac39392919062003abd565b604051602081830303815290604052945050505b505b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b600084868e8e868860535460405162001b1b98979695949392919062003cc7565b60405180910390a162001c0f620009b2600085878f8f8789805190602001206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b861562001c205762001c2062001f27565b5050505062001c2e60018055565b50505050505050565b606c5473ffffffffffffffffffffffffffffffffffffffff16331462001c89576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362002c80565b600084815b602081101562001d6e57600163ffffffff8616821c8116900362001d0a5785816020811062001ccb5762001ccb62003b8a565b60200201358260405160200162001cec929190918252602082015260400190565b60405160208183030381529060405280519060200120915062001d59565b8186826020811062001d205762001d2062003b8a565b602002013560405160200162001d40929190918252602082015260400190565b6040516020818303038152906040528051906020012091505b8062001d658162003be8565b91505062001c98565b50821490505b949350505050565b60685460ff161562001dba576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556040517f2261efe5aef6fedc1fd1550b25facc9181745623049c7901287030b9ad1a549790600090a1565b80600162001e216020600262003e79565b62001e2d919062003cb1565b6053541062001e68576040517fef5ccf6600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060536000815462001e7b9062003be8565b9182905550905060005b602081101562001f17578082901c60011660010362001ebd57826033826020811062001eb55762001eb562003b8a565b015550505050565b6033816020811062001ed35762001ed362003b8a565b01546040805160208101929092528101849052606001604051602081830303815290604052805190602001209250808062001f0e9062003be8565b91505062001e85565b5062001f2262003e87565b505050565b6053546068805463ffffffff909216790100000000000000000000000000000000000000000000000000027fffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffff909216919091179081905573ffffffffffffffffffffffffffffffffffffffff65010000000000909104166333d6247d62001fad62001178565b6040518263ffffffff1660e01b815260040162001fcc91815260200190565b600060405180830381600087803b15801562001fe757600080fd5b505af1158015620014a7573d6000803e3d6000fd5b6200200d8b63ffffffff1662002d10565b6068546040805160208082018e90528183018d9052825180830384018152606083019384905280519101207f257b363200000000000000000000000000000000000000000000000000000000909252606481019190915260009165010000000000900473ffffffffffffffffffffffffffffffffffffffff169063257b3632906084016020604051808303816000875af1158015620020b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620020d6919062003c97565b90508060000362002112576040517e2f6fad00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff88811661010090920416146200215c576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606854600090610100900463ffffffff166200217a5750896200217d565b508a5b620021a66200219d848c8c8c8c8c8c8c604051620008d592919062003881565b8f8f8462001c93565b620021dd576040517fe0417cec00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905262001f229084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262002d75565b600054610100900460ff166200235c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6200070362002e88565b600260015403620023d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640162001324565b6002600155565b6000620023ec600482848662003eb6565b620023f79162003ee2565b90507f2afa5331000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000821601620026765760008080808080806200245a896004818d62003eb6565b81019062002469919062003f2b565b96509650965096509650965096503373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614620024dd576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff861630146200252d576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8a851462002567576040517f03fffc4b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff89811660248301528881166044830152606482018890526084820187905260ff861660a483015260c4820185905260e48083018590528351808403909101815261010490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fd505accf000000000000000000000000000000000000000000000000000000001790529151918e1691620026229190620038e6565b6000604051808303816000865af19150503d806000811462002661576040519150601f19603f3d011682016040523d82523d6000602084013e62002666565b606091505b50505050505050505050620009c9565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f8fcbaf0c0000000000000000000000000000000000000000000000000000000014620026f2576040517fe282c0ba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080808080806200270a8a6004818e62003eb6565b81019062002719919062003f86565b975097509750975097509750975097503373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16146200278f576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff87163014620027df576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8a811660248301528981166044830152606482018990526084820188905286151560a483015260ff861660c483015260e482018590526101048083018590528351808403909101815261012490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f8fcbaf0c000000000000000000000000000000000000000000000000000000001790529151918f1691620028a39190620038e6565b6000604051808303816000865af19150503d8060008114620028e2576040519150601f19603f3d011682016040523d82523d6000602084013e620028e7565b606091505b50505050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052620014a79085907f23b872dd000000000000000000000000000000000000000000000000000000009060840162002240565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f06fdde03000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff861691620029dd9190620038e6565b600060405180830381855afa9150503d806000811462002a1a576040519150601f19603f3d011682016040523d82523d6000602084013e62002a1f565b606091505b50915091508162002a66576040518060400160405280600781526020017f4e4f5f4e414d450000000000000000000000000000000000000000000000000081525062001d74565b62001d748162002f21565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f95d89b41000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff86169162002af59190620038e6565b600060405180830381855afa9150503d806000811462002b32576040519150601f19603f3d011682016040523d82523d6000602084013e62002b37565b606091505b50915091508162002a66576040518060400160405280600981526020017f4e4f5f53594d424f4c000000000000000000000000000000000000000000000081525062001d74565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f313ce5670000000000000000000000000000000000000000000000000000000017905290516000918291829173ffffffffffffffffffffffffffffffffffffffff86169162002c019190620038e6565b600060405180830381855afa9150503d806000811462002c3e576040519150601f19603f3d011682016040523d82523d6000602084013e62002c43565b606091505b509150915081801562002c57575080516020145b62002c6457601262001d74565b8080602001905181019062001d74919062004012565b60018055565b60685460ff1662002cbd576040517f5386698100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040517f1e5e34eea33501aecf2ebec9fe0e884a40804275ea7fe10b2ba084c8374308b390600090a1565b600881901c60008181526069602052604081208054600160ff861690811b91821892839055929091908183169003620009c9576040517f646cf55800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600062002dd9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16620031119092919063ffffffff16565b80519091501562001f22578080602001905181019062002dfa919062004032565b62001f22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840162001324565b600054610100900460ff1662002c7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6060604082511062002f435781806020019051810190620007a2919062004052565b8151602003620030d35760005b60208110801562002f9b575082818151811062002f715762002f7162003b8a565b01602001517fff000000000000000000000000000000000000000000000000000000000000001615155b1562002fb6578062002fad8162003be8565b91505062002f50565b8060000362002ffa57505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e4700000000000000000000000000006020820152919050565b60008167ffffffffffffffff81111562003018576200301862003891565b6040519080825280601f01601f19166020018201604052801562003043576020820181803683370190505b50905060005b82811015620030cb5784818151811062003067576200306762003b8a565b602001015160f81c60f81b82828151811062003087576200308762003b8a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080620030c28162003be8565b91505062003049565b509392505050565b505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e470000000000000000000000000000602082015290565b919050565b606062001d748484600085856000808673ffffffffffffffffffffffffffffffffffffffff168587604051620031489190620038e6565b60006040518083038185875af1925050503d806000811462003187576040519150601f19603f3d011682016040523d82523d6000602084013e6200318c565b606091505b50915091506200319f87838387620031aa565b979650505050505050565b60608315620032455782516000036200323d5773ffffffffffffffffffffffffffffffffffffffff85163b6200323d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162001324565b508162001d74565b62001d7483838151156200325c5781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620013249190620040d2565b611b6680620040e883390190565b803563ffffffff811681146200310c57600080fd5b73ffffffffffffffffffffffffffffffffffffffff81168114620032d857600080fd5b50565b60008060408385031215620032ef57600080fd5b620032fa83620032a0565b915060208301356200330c81620032b5565b809150509250929050565b8015158114620032d857600080fd5b60008083601f8401126200333957600080fd5b50813567ffffffffffffffff8111156200335257600080fd5b6020830191508360208285010111156200336b57600080fd5b9250929050565b6000806000806000608086880312156200338b57600080fd5b6200339686620032a0565b94506020860135620033a881620032b5565b93506040860135620033ba8162003317565b9250606086013567ffffffffffffffff811115620033d757600080fd5b620033e58882890162003326565b969995985093965092949392505050565b806104008101831015620007a257600080fd5b60008060008060008060008060008060006105208c8e0312156200342c57600080fd5b620034388d8d620033f6565b9a50620034496104008d01620032a0565b99506104208c013598506104408c013597506200346a6104608d01620032a0565b96506104808c01356200347d81620032b5565b95506200348e6104a08d01620032a0565b94506104c08c0135620034a181620032b5565b93506104e08c013592506105008c013567ffffffffffffffff811115620034c757600080fd5b620034d58e828f0162003326565b915080935050809150509295989b509295989b9093969950565b6000602082840312156200350257600080fd5b81356200350f81620032b5565b9392505050565b60ff81168114620032d857600080fd5b600080600080600080600060e0888a0312156200354257600080fd5b87356200354f8162003516565b96506200355f60208901620032a0565b955060408801356200357181620032b5565b94506200358160608901620032a0565b935060808801356200359381620032b5565b9699959850939692959460a0840135945060c09093013592915050565b600080600060608486031215620035c657600080fd5b620035d184620032a0565b92506020840135620035e381620032b5565b91506040840135620035f581620032b5565b809150509250925092565b6000602082840312156200361357600080fd5b5035919050565b600080600080600080600060a0888a0312156200363657600080fd5b6200364188620032a0565b965060208801356200365381620032b5565b9550604088013567ffffffffffffffff808211156200367157600080fd5b6200367f8b838c0162003326565b909750955060608a01359150808211156200369957600080fd5b50620036a88a828b0162003326565b9094509250506080880135620036be8162003516565b8091505092959891949750929550565b600080600080600080600060c0888a031215620036ea57600080fd5b620036f588620032a0565b965060208801356200370781620032b5565b95506040880135945060608801356200372081620032b5565b93506080880135620037328162003317565b925060a088013567ffffffffffffffff8111156200374f57600080fd5b6200375d8a828b0162003326565b989b979a50959850939692959293505050565b60008060008061046085870312156200378857600080fd5b843593506200379b8660208701620033f6565b9250620037ac6104208601620032a0565b939692955092936104400135925050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b600061010060ff8c16835263ffffffff808c16602085015273ffffffffffffffffffffffffffffffffffffffff808c166040860152818b166060860152808a166080860152508760a08501528160c0850152620038678285018789620037bd565b925080851660e085015250509a9950505050505050505050565b8183823760009101908152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60005b83811015620038dd578181015183820152602001620038c3565b50506000910152565b60008251620038fa818460208701620038c0565b9190910192915050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156200394e576200394e62003891565b604052919050565b600067ffffffffffffffff82111562003973576200397362003891565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112620039b157600080fd5b8135620039c8620039c28262003956565b62003904565b818152846020838601011115620039de57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121562003a1157600080fd5b833567ffffffffffffffff8082111562003a2a57600080fd5b62003a38878388016200399f565b9450602086013591508082111562003a4f57600080fd5b5062003a5e868287016200399f565b9250506040840135620035f58162003516565b6000815180845262003a8b816020860160208601620038c0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60608152600062003ad2606083018662003a71565b828103602084015262003ae6818662003a71565b91505060ff83166040830152949350505050565b63ffffffff86168152600073ffffffffffffffffffffffffffffffffffffffff8087166020840152808616604084015250608060608301526200319f608083018486620037bd565b73ffffffffffffffffffffffffffffffffffffffff8516815263ffffffff8416602082015260606040820152600062003b80606083018486620037bd565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820362003c1c5762003c1c62003bb9565b5060010190565b60608152600062003c39606083018789620037bd565b828103602084015262003c4e818688620037bd565b91505060ff831660408301529695505050505050565b6000835162003c78818460208801620038c0565b83519083019062003c8e818360208801620038c0565b01949350505050565b60006020828403121562003caa57600080fd5b5051919050565b81810381811115620007a257620007a262003bb9565b600061010060ff8b16835263ffffffff808b16602085015273ffffffffffffffffffffffffffffffffffffffff808b166040860152818a1660608601528089166080860152508660a08501528160c085015262003d278285018762003a71565b925080851660e085015250509998505050505050505050565b600181815b8085111562003d9f57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003d835762003d8362003bb9565b8085161562003d9157918102915b93841c939080029062003d45565b509250929050565b60008262003db857506001620007a2565b8162003dc757506000620007a2565b816001811462003de0576002811462003deb5762003e0b565b6001915050620007a2565b60ff84111562003dff5762003dff62003bb9565b50506001821b620007a2565b5060208310610133831016604e8410600b841016171562003e30575081810a620007a2565b62003e3c838362003d40565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003e715762003e7162003bb9565b029392505050565b60006200350f838362003da7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b6000808585111562003ec757600080fd5b8386111562003ed557600080fd5b5050820193919092039150565b7fffffffff00000000000000000000000000000000000000000000000000000000813581811691600485101562003f235780818660040360031b1b83161692505b505092915050565b600080600080600080600060e0888a03121562003f4757600080fd5b873562003f5481620032b5565b9650602088013562003f6681620032b5565b955060408801359450606088013593506080880135620035938162003516565b600080600080600080600080610100898b03121562003fa457600080fd5b883562003fb181620032b5565b9750602089013562003fc381620032b5565b96506040890135955060608901359450608089013562003fe38162003317565b935060a089013562003ff58162003516565b979a969950949793969295929450505060c08201359160e0013590565b6000602082840312156200402557600080fd5b81516200350f8162003516565b6000602082840312156200404557600080fd5b81516200350f8162003317565b6000602082840312156200406557600080fd5b815167ffffffffffffffff8111156200407d57600080fd5b8201601f810184136200408f57600080fd5b8051620040a0620039c28262003956565b818152856020838501011115620040b657600080fd5b620040c9826020830160208601620038c0565b95945050505050565b6020815260006200350f602083018462003a7156fe6101006040523480156200001257600080fd5b5060405162001b6638038062001b6683398101604081905262000035916200028d565b82826003620000458382620003a1565b506004620000548282620003a1565b50503360c0525060ff811660e052466080819052620000739062000080565b60a052506200046d915050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620000ad6200012e565b805160209182012060408051808201825260018152603160f81b90840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b6060600380546200013f9062000312565b80601f01602080910402602001604051908101604052809291908181526020018280546200016d9062000312565b8015620001be5780601f106200019257610100808354040283529160200191620001be565b820191906000526020600020905b815481529060010190602001808311620001a057829003601f168201915b5050505050905090565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001f057600080fd5b81516001600160401b03808211156200020d576200020d620001c8565b604051601f8301601f19908116603f01168101908282118183101715620002385762000238620001c8565b816040528381526020925086838588010111156200025557600080fd5b600091505b838210156200027957858201830151818301840152908201906200025a565b600093810190920192909252949350505050565b600080600060608486031215620002a357600080fd5b83516001600160401b0380821115620002bb57600080fd5b620002c987838801620001de565b94506020860151915080821115620002e057600080fd5b50620002ef86828701620001de565b925050604084015160ff811681146200030757600080fd5b809150509250925092565b600181811c908216806200032757607f821691505b6020821081036200034857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200039c57600081815260208120601f850160051c81016020861015620003775750805b601f850160051c820191505b81811015620003985782815560010162000383565b5050505b505050565b81516001600160401b03811115620003bd57620003bd620001c8565b620003d581620003ce845462000312565b846200034e565b602080601f8311600181146200040d5760008415620003f45750858301515b600019600386901b1c1916600185901b17855562000398565b600085815260208120601f198616915b828110156200043e578886015182559484019460019091019084016200041d565b50858210156200045d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e0516116aa620004bc6000396000610237015260008181610307015281816105c001526106a70152600061053a015260008181610379015261050401526116aa6000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806370a08231116100d8578063a457c2d71161008c578063d505accf11610066578063d505accf1461039b578063dd62ed3e146103ae578063ffa1ad74146103f457600080fd5b8063a457c2d71461034e578063a9059cbb14610361578063cd0d00961461037457600080fd5b806395d89b41116100bd57806395d89b41146102e75780639dc29fac146102ef578063a3c573eb1461030257600080fd5b806370a08231146102915780637ecebe00146102c757600080fd5b806330adf81f1161012f5780633644e515116101145780633644e51514610261578063395093511461026957806340c10f191461027c57600080fd5b806330adf81f14610209578063313ce5671461023057600080fd5b806318160ddd1161016057806318160ddd146101bd57806320606b70146101cf57806323b872dd146101f657600080fd5b806306fdde031461017c578063095ea7b31461019a575b600080fd5b610184610430565b60405161019191906113e4565b60405180910390f35b6101ad6101a8366004611479565b6104c2565b6040519015158152602001610191565b6002545b604051908152602001610191565b6101c17f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b6101ad6102043660046114a3565b6104dc565b6101c17f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610191565b6101c1610500565b6101ad610277366004611479565b61055c565b61028f61028a366004611479565b6105a8565b005b6101c161029f3660046114df565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6101c16102d53660046114df565b60056020526000908152604090205481565b610184610680565b61028f6102fd366004611479565b61068f565b6103297f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610191565b6101ad61035c366004611479565b61075e565b6101ad61036f366004611479565b61082f565b6101c17f000000000000000000000000000000000000000000000000000000000000000081565b61028f6103a9366004611501565b61083d565b6101c16103bc366004611574565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6101846040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b60606003805461043f906115a7565b80601f016020809104026020016040519081016040528092919081815260200182805461046b906115a7565b80156104b85780601f1061048d576101008083540402835291602001916104b8565b820191906000526020600020905b81548152906001019060200180831161049b57829003601f168201915b5050505050905090565b6000336104d0818585610b73565b60019150505b92915050565b6000336104ea858285610d27565b6104f5858585610dfe565b506001949350505050565b60007f00000000000000000000000000000000000000000000000000000000000000004614610537576105324661106d565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906104d090829086906105a3908790611629565b610b73565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610672576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d4272696467650000000000000000000000000000000060648201526084015b60405180910390fd5b61067c8282611135565b5050565b60606004805461043f906115a7565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610754576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d427269646765000000000000000000000000000000006064820152608401610669565b61067c8282611228565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610669565b6104f58286868403610b73565b6000336104d0818585610dfe565b834211156108cc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f546f6b656e577261707065643a3a7065726d69743a204578706972656420706560448201527f726d6974000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260056020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a9190866109268361163c565b9091555060408051602081019690965273ffffffffffffffffffffffffffffffffffffffff94851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610991610500565b6040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281019190915260428101839052606201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015610a55573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590610ad057508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610b5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f546f6b656e577261707065643a3a7065726d69743a20496e76616c696420736960448201527f676e6174757265000000000000000000000000000000000000000000000000006064820152608401610669565b610b678a8a8a610b73565b50505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8316610c15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610cb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610df85781811015610deb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610669565b610df88484848403610b73565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610ea1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610f44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610ffa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610df8565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611098610430565b8051602091820120604080518082018252600181527f310000000000000000000000000000000000000000000000000000000000000090840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b73ffffffffffffffffffffffffffffffffffffffff82166111b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610669565b80600260008282546111c49190611629565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff82166112cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015611381576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610d1a565b600060208083528351808285015260005b81811015611411578581018301518582016040015282016113f5565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461147457600080fd5b919050565b6000806040838503121561148c57600080fd5b61149583611450565b946020939093013593505050565b6000806000606084860312156114b857600080fd5b6114c184611450565b92506114cf60208501611450565b9150604084013590509250925092565b6000602082840312156114f157600080fd5b6114fa82611450565b9392505050565b600080600080600080600060e0888a03121561151c57600080fd5b61152588611450565b965061153360208901611450565b95506040880135945060608801359350608088013560ff8116811461155757600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561158757600080fd5b61159083611450565b915061159e60208401611450565b90509250929050565b600181811c908216806115bb57607f821691505b6020821081036115f4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156104d6576104d66115fa565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361166d5761166d6115fa565b506001019056fea26469706673582212208d88fee561cff7120d381c345cfc534cef8229a272dc5809d4bbb685ad67141164736f6c63430008110033a2646970667358221220d9b3ca7b13ec80ac58634ddf0ecebe71e209a71f532614949b9e720413f50c8364736f6c63430008110033"
43
- },
44
- {
45
- "contractName": "PolygonZkEVMBridge proxy",
46
- "balance": "200000000000000000000000000",
47
- "nonce": "1",
48
- "address": "0x528e26b25a34a4A5d0dbDa1d57D318153d2ED582",
49
- "bytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461088b565b610135565b61006b6100a33660046108a6565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461088b565b610231565b34801561011257600080fd5b506100bd61025e565b6101236102d4565b61013361012e6103ab565b6103b5565b565b61013d6103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481604051806020016040528060008152506000610419565b50565b61017461011b565b6101876103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610419915050565b505050565b6101e661011b565b60006101fd6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103ab565b905090565b61022e61011b565b90565b6102396103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481610444565b60006102686103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103d9565b60606102b183836040518060600160405280602781526020016109bb602791396104a5565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6102dc6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b600061022161052a565b3660008037600080366000845af43d6000803e8080156103d4573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b61042283610552565b60008251118061042f5750805b156101e65761043e838361028c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61046d6103d9565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a16101748161059f565b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516104cf919061094d565b600060405180830381855af49150503d806000811461050a576040519150601f19603f3d011682016040523d82523d6000602084013e61050f565b606091505b5091509150610520868383876106ab565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103fd565b61055b81610753565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff8116610642576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103a2565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b6060831561074157825160000361073a5773ffffffffffffffffffffffffffffffffffffffff85163b61073a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103a2565b508161074b565b61074b838361081e565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff81163b6107f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016103a2565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610665565b81511561082e5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a29190610969565b803573ffffffffffffffffffffffffffffffffffffffff8116811461088657600080fd5b919050565b60006020828403121561089d57600080fd5b6102b182610862565b6000806000604084860312156108bb57600080fd5b6108c484610862565b9250602084013567ffffffffffffffff808211156108e157600080fd5b818601915086601f8301126108f557600080fd5b81358181111561090457600080fd5b87602082850101111561091657600080fd5b6020830194508093505050509250925092565b60005b8381101561094457818101518382015260200161092c565b50506000910152565b6000825161095f818460208701610929565b9190910192915050565b6020815260008251806020840152610988816040850160208701610929565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220a1af0d6cb4f1e31496a4c5c1448913bce4bd6ad3a39e47c6f7190c114d6f9bf464736f6c63430008110033",
50
- "storage": {
51
- "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000000000000000000000000000000000000000001",
52
- "0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000001",
53
- "0x0000000000000000000000000000000000000000000000000000000000000068": "0x00000000000000a40d5f56745a118d0906a34e69aec8c0db1cb8fa0000000100",
54
- "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x00000000000000000000000085ceb41028b1a5ed2b88e395145344837308b251",
55
- "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x0000000000000000000000008bd36ca1a55e389335004872aa3c3be0969d3aa7"
56
- }
57
- },
58
- {
59
- "contractName": "PolygonZkEVMGlobalExitRootL2 implementation",
60
- "balance": "0",
61
- "nonce": "1",
62
- "address": "0x282a631D9F3Ef04Bf1A44B4C9e8bDC8EB278917f",
63
- "bytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806301fd904414610051578063257b36321461006d57806333d6247d1461008d578063a3c573eb146100a2575b600080fd5b61005a60015481565b6040519081526020015b60405180910390f35b61005a61007b366004610162565b60006020819052908152604090205481565b6100a061009b366004610162565b6100ee565b005b6100c97f000000000000000000000000528e26b25a34a4a5d0dbda1d57d318153d2ed58281565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610064565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000528e26b25a34a4a5d0dbda1d57d318153d2ed582161461015d576040517fb49365dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600155565b60006020828403121561017457600080fd5b503591905056fea2646970667358221220a187fc278346c1b61c449ea3641002b6eac2bda3351a122a12c35099f933696864736f6c63430008110033"
64
- },
65
- {
66
- "contractName": "PolygonZkEVMGlobalExitRootL2 proxy",
67
- "balance": "0",
68
- "nonce": "1",
69
- "address": "0xa40d5f56745a118d0906a34e69aec8c0db1cb8fa",
70
- "bytecode": "0x60806040523661001357610011610017565b005b6100115b61001f6101b7565b6001600160a01b0316336001600160a01b0316141561016f5760606001600160e01b031960003516631b2ce7f360e11b8114156100655761005e6101ea565b9150610167565b6001600160e01b0319811663278f794360e11b14156100865761005e610241565b6001600160e01b031981166308f2839760e41b14156100a75761005e610287565b6001600160e01b031981166303e1469160e61b14156100c85761005e6102b8565b6001600160e01b03198116635c60da1b60e01b14156100e95761005e6102f8565b60405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b815160208301f35b61017761030c565b565b606061019e83836040518060600160405280602781526020016108576027913961031c565b9392505050565b90565b6001600160a01b03163b151590565b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b60606101f4610394565b600061020336600481846106a2565b81019061021091906106e8565b905061022d8160405180602001604052806000815250600061039f565b505060408051602081019091526000815290565b606060008061025336600481846106a2565b8101906102609190610719565b915091506102708282600161039f565b604051806020016040528060008152509250505090565b6060610291610394565b60006102a036600481846106a2565b8101906102ad91906106e8565b905061022d816103cb565b60606102c2610394565b60006102cc6101b7565b604080516001600160a01b03831660208201529192500160405160208183030381529060405291505090565b6060610302610394565b60006102cc610422565b610177610317610422565b610431565b6060600080856001600160a01b0316856040516103399190610807565b600060405180830381855af49150503d8060008114610374576040519150601f19603f3d011682016040523d82523d6000602084013e610379565b606091505b509150915061038a86838387610455565b9695505050505050565b341561017757600080fd5b6103a8836104d3565b6000825111806103b55750805b156103c6576103c48383610179565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103f46101b7565b604080516001600160a01b03928316815291841660208301520160405180910390a161041f81610513565b50565b600061042c6105bc565b905090565b3660008037600080366000845af43d6000803e808015610450573d6000f35b3d6000fd5b606083156104c15782516104ba576001600160a01b0385163b6104ba5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161015e565b50816104cb565b6104cb83836105e4565b949350505050565b6104dc8161060e565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b0381166105785760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b606482015260840161015e565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80546001600160a01b0319166001600160a01b039290921691909117905550565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6101db565b8151156105f45781518083602001fd5b8060405162461bcd60e51b815260040161015e9190610823565b6001600160a01b0381163b61067b5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161015e565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc61059b565b600080858511156106b257600080fd5b838611156106bf57600080fd5b5050820193919092039150565b80356001600160a01b03811681146106e357600080fd5b919050565b6000602082840312156106fa57600080fd5b61019e826106cc565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561072c57600080fd5b610735836106cc565b9150602083013567ffffffffffffffff8082111561075257600080fd5b818501915085601f83011261076657600080fd5b81358181111561077857610778610703565b604051601f8201601f19908116603f011681019083821181831017156107a0576107a0610703565b816040528281528860208487010111156107b957600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b838110156107f65781810151838201526020016107de565b838111156103c45750506000910152565b600082516108198184602087016107db565b9190910192915050565b60208152600082518060208401526108428160408501602087016107db565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122012bb4f564f73959a03513dc74fc3c6e40e8386e6f02c16b78d6db00ce0aa16af64736f6c63430008090033",
71
- "storage": {
72
- "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x00000000000000000000000085ceb41028b1a5ed2b88e395145344837308b251",
73
- "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x000000000000000000000000282a631d9f3ef04bf1a44b4c9e8bdc8eb278917f"
74
- }
75
- },
76
- {
77
- "contractName": "PolygonZkEVMTimelock",
78
- "balance": "0",
79
- "nonce": "1",
80
- "address": "0xdbC6981a11fc2B000c635bFA7C47676b25C87D39",
81
- "bytecode": "0x6080604052600436106101c65760003560e01c806364d62353116100f7578063b1c5f42711610095578063d547741f11610064578063d547741f14610661578063e38335e514610681578063f23a6e6114610694578063f27a0c92146106d957600080fd5b8063b1c5f427146105af578063bc197c81146105cf578063c4d252f514610614578063d45c44351461063457600080fd5b80638f61f4f5116100d15780638f61f4f5146104e157806391d1485414610515578063a217fddf14610566578063b08e51c01461057b57600080fd5b806364d62353146104815780638065657f146104a15780638f2a0bb0146104c157600080fd5b8063248a9ca31161016457806331d507501161013e57806331d50750146103c857806336568abe146103e85780633a6aae7214610408578063584b153e1461046157600080fd5b8063248a9ca3146103475780632ab0f529146103775780632f2ff15d146103a857600080fd5b80630d3cf6fc116101a05780630d3cf6fc1461026b578063134008d31461029f57806313bc9f20146102b2578063150b7a02146102d257600080fd5b806301d5062a146101d257806301ffc9a7146101f457806307bd02651461022957600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004611c52565b6106ee565b005b34801561020057600080fd5b5061021461020f366004611cc7565b610783565b60405190151581526020015b60405180910390f35b34801561023557600080fd5b5061025d7fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e6381565b604051908152602001610220565b34801561027757600080fd5b5061025d7f5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca581565b6101f26102ad366004611d09565b6107df565b3480156102be57600080fd5b506102146102cd366004611d75565b6108d7565b3480156102de57600080fd5b506103166102ed366004611e9a565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610220565b34801561035357600080fd5b5061025d610362366004611d75565b60009081526020819052604090206001015490565b34801561038357600080fd5b50610214610392366004611d75565b6000908152600160208190526040909120541490565b3480156103b457600080fd5b506101f26103c3366004611f02565b6108fd565b3480156103d457600080fd5b506102146103e3366004611d75565b610927565b3480156103f457600080fd5b506101f2610403366004611f02565b610940565b34801561041457600080fd5b5061043c7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610220565b34801561046d57600080fd5b5061021461047c366004611d75565b6109f8565b34801561048d57600080fd5b506101f261049c366004611d75565b610a0e565b3480156104ad57600080fd5b5061025d6104bc366004611d09565b610ade565b3480156104cd57600080fd5b506101f26104dc366004611f73565b610b1d565b3480156104ed57600080fd5b5061025d7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc181565b34801561052157600080fd5b50610214610530366004611f02565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b34801561057257600080fd5b5061025d600081565b34801561058757600080fd5b5061025d7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f78381565b3480156105bb57600080fd5b5061025d6105ca366004612025565b610d4f565b3480156105db57600080fd5b506103166105ea36600461214e565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b34801561062057600080fd5b506101f261062f366004611d75565b610d94565b34801561064057600080fd5b5061025d61064f366004611d75565b60009081526001602052604090205490565b34801561066d57600080fd5b506101f261067c366004611f02565b610e8f565b6101f261068f366004612025565b610eb4565b3480156106a057600080fd5b506103166106af3660046121f8565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b3480156106e557600080fd5b5061025d611161565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc161071881611244565b6000610728898989898989610ade565b90506107348184611251565b6000817f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8b8b8b8b8b8a604051610770969594939291906122a6565b60405180910390a3505050505050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e00000000000000000000000000000000000000000000000000000000014806107d957506107d98261139e565b92915050565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff1661085c5761085c8133611435565b600061086c888888888888610ade565b905061087881856114ed565b6108848888888861162a565b6000817fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588a8a8a8a6040516108bc94939291906122f1565b60405180910390a36108cd8161172e565b5050505050505050565b6000818152600160205260408120546001811180156108f65750428111155b9392505050565b60008281526020819052604090206001015461091881611244565b61092283836117d7565b505050565b60008181526001602052604081205481905b1192915050565b73ffffffffffffffffffffffffffffffffffffffff811633146109ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6109f482826118c7565b5050565b6000818152600160208190526040822054610939565b333014610a9d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201527f62652074696d656c6f636b00000000000000000000000000000000000000000060648201526084016109e1565b60025460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1600255565b6000868686868686604051602001610afb969594939291906122a6565b6040516020818303038152906040528051906020012090509695505050505050565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1610b4781611244565b888714610bd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b888514610c65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b6000610c778b8b8b8b8b8b8b8b610d4f565b9050610c838184611251565b60005b8a811015610d415780827f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8e8e85818110610cc357610cc3612331565b9050602002016020810190610cd89190612360565b8d8d86818110610cea57610cea612331565b905060200201358c8c87818110610d0357610d03612331565b9050602002810190610d15919061237b565b8c8b604051610d29969594939291906122a6565b60405180910390a3610d3a8161240f565b9050610c86565b505050505050505050505050565b60008888888888888888604051602001610d709897969594939291906124f7565b60405160208183030381529060405280519060200120905098975050505050505050565b7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783610dbe81611244565b610dc7826109f8565b610e53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20636160448201527f6e6e6f742062652063616e63656c6c656400000000000000000000000000000060648201526084016109e1565b6000828152600160205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b600082815260208190526040902060010154610eaa81611244565b61092283836118c7565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff16610f3157610f318133611435565b878614610fc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b87841461104f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b60006110618a8a8a8a8a8a8a8a610d4f565b905061106d81856114ed565b60005b8981101561114b5760008b8b8381811061108c5761108c612331565b90506020020160208101906110a19190612360565b905060008a8a848181106110b7576110b7612331565b9050602002013590503660008a8a868181106110d5576110d5612331565b90506020028101906110e7919061237b565b915091506110f78484848461162a565b84867fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588686868660405161112e94939291906122f1565b60405180910390a350505050806111449061240f565b9050611070565b506111558161172e565b50505050505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff161580159061123257507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166315064c966040518163ffffffff1660e01b8152600401602060405180830381865afa15801561120e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123291906125be565b1561123d5750600090565b5060025490565b61124e8133611435565b50565b61125a82610927565b156112e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201527f7265616479207363686564756c6564000000000000000000000000000000000060648201526084016109e1565b6112ef611161565b81101561137e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e7460448201527f2064656c6179000000000000000000000000000000000000000000000000000060648201526084016109e1565b61138881426125e0565b6000928352600160205260409092209190915550565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806107d957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107d9565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f4576114738161197e565b61147e83602061199d565b60405160200161148f929190612617565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526109e191600401612698565b6114f6826108d7565b611582576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b80158061159e5750600081815260016020819052604090912054145b6109f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e67206465706560448201527f6e64656e6379000000000000000000000000000000000000000000000000000060648201526084016109e1565b60008473ffffffffffffffffffffffffffffffffffffffff168484846040516116549291906126e9565b60006040518083038185875af1925050503d8060008114611691576040519150601f19603f3d011682016040523d82523d6000602084013e611696565b606091505b5050905080611727576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e67207460448201527f72616e73616374696f6e2072657665727465640000000000000000000000000060648201526084016109e1565b5050505050565b611737816108d7565b6117c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b600090815260016020819052604090912055565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556118693390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606107d973ffffffffffffffffffffffffffffffffffffffff831660145b606060006119ac8360026126f9565b6119b79060026125e0565b67ffffffffffffffff8111156119cf576119cf611d8e565b6040519080825280601f01601f1916602001820160405280156119f9576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611a3057611a30612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611a9357611a93612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611acf8460026126f9565b611ada9060016125e0565b90505b6001811115611b77577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611b1b57611b1b612331565b1a60f81b828281518110611b3157611b31612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611b7081612710565b9050611add565b5083156108f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109e1565b803573ffffffffffffffffffffffffffffffffffffffff81168114611c0457600080fd5b919050565b60008083601f840112611c1b57600080fd5b50813567ffffffffffffffff811115611c3357600080fd5b602083019150836020828501011115611c4b57600080fd5b9250929050565b600080600080600080600060c0888a031215611c6d57600080fd5b611c7688611be0565b965060208801359550604088013567ffffffffffffffff811115611c9957600080fd5b611ca58a828b01611c09565b989b979a50986060810135976080820135975060a09091013595509350505050565b600060208284031215611cd957600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146108f657600080fd5b60008060008060008060a08789031215611d2257600080fd5b611d2b87611be0565b955060208701359450604087013567ffffffffffffffff811115611d4e57600080fd5b611d5a89828a01611c09565b979a9699509760608101359660809091013595509350505050565b600060208284031215611d8757600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611e0457611e04611d8e565b604052919050565b600082601f830112611e1d57600080fd5b813567ffffffffffffffff811115611e3757611e37611d8e565b611e6860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611dbd565b818152846020838601011115611e7d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215611eb057600080fd5b611eb985611be0565b9350611ec760208601611be0565b925060408501359150606085013567ffffffffffffffff811115611eea57600080fd5b611ef687828801611e0c565b91505092959194509250565b60008060408385031215611f1557600080fd5b82359150611f2560208401611be0565b90509250929050565b60008083601f840112611f4057600080fd5b50813567ffffffffffffffff811115611f5857600080fd5b6020830191508360208260051b8501011115611c4b57600080fd5b600080600080600080600080600060c08a8c031215611f9157600080fd5b893567ffffffffffffffff80821115611fa957600080fd5b611fb58d838e01611f2e565b909b50995060208c0135915080821115611fce57600080fd5b611fda8d838e01611f2e565b909950975060408c0135915080821115611ff357600080fd5b506120008c828d01611f2e565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b60008060008060008060008060a0898b03121561204157600080fd5b883567ffffffffffffffff8082111561205957600080fd5b6120658c838d01611f2e565b909a50985060208b013591508082111561207e57600080fd5b61208a8c838d01611f2e565b909850965060408b01359150808211156120a357600080fd5b506120b08b828c01611f2e565b999c989b509699959896976060870135966080013595509350505050565b600082601f8301126120df57600080fd5b8135602067ffffffffffffffff8211156120fb576120fb611d8e565b8160051b61210a828201611dbd565b928352848101820192828101908785111561212457600080fd5b83870192505b848310156121435782358252918301919083019061212a565b979650505050505050565b600080600080600060a0868803121561216657600080fd5b61216f86611be0565b945061217d60208701611be0565b9350604086013567ffffffffffffffff8082111561219a57600080fd5b6121a689838a016120ce565b945060608801359150808211156121bc57600080fd5b6121c889838a016120ce565b935060808801359150808211156121de57600080fd5b506121eb88828901611e0c565b9150509295509295909350565b600080600080600060a0868803121561221057600080fd5b61221986611be0565b945061222760208701611be0565b93506040860135925060608601359150608086013567ffffffffffffffff81111561225157600080fd5b6121eb88828901611e0c565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff8716815285602082015260a0604082015260006122dc60a08301868861225d565b60608301949094525060800152949350505050565b73ffffffffffffffffffffffffffffffffffffffff8516815283602082015260606040820152600061232760608301848661225d565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561237257600080fd5b6108f682611be0565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126123b057600080fd5b83018035915067ffffffffffffffff8211156123cb57600080fd5b602001915036819003821315611c4b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612440576124406123e0565b5060010190565b81835260006020808501808196508560051b810191508460005b878110156124ea57828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18836030181126124a057600080fd5b8701858101903567ffffffffffffffff8111156124bc57600080fd5b8036038213156124cb57600080fd5b6124d686828461225d565b9a87019a9550505090840190600101612461565b5091979650505050505050565b60a0808252810188905260008960c08301825b8b8110156125455773ffffffffffffffffffffffffffffffffffffffff61253084611be0565b1682526020928301929091019060010161250a565b5083810360208501528881527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff89111561257e57600080fd5b8860051b9150818a602083013701828103602090810160408501526125a69082018789612447565b60608401959095525050608001529695505050505050565b6000602082840312156125d057600080fd5b815180151581146108f657600080fd5b808201808211156107d9576107d96123e0565b60005b8381101561260e5781810151838201526020016125f6565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161264f8160178501602088016125f3565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161268c8160288401602088016125f3565b01602801949350505050565b60208152600082518060208401526126b78160408501602087016125f3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b8183823760009101908152919050565b80820281158282048414176107d9576107d96123e0565b60008161271f5761271f6123e0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea26469706673582212206416c4e08f97752b4bb06159524dac058d3dccd8775e57ef1b01505751ebf7af64736f6c63430008110033",
82
- "storage": {
83
- "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000000e10",
84
- "0xf587dde6f8846415188f807710a3304f72092565918b30307d60efdc8014f20b": "0x0000000000000000000000000000000000000000000000000000000000000001",
85
- "0x07020fe9de9b8274d1e6cc0668a6f6344a870f35e5a847590c8069dfa85ac78f": "0x0000000000000000000000000000000000000000000000000000000000000001",
86
- "0x64494413541ff93b31aa309254e3fed72a7456e9845988b915b4c7a7ceba8814": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5",
87
- "0xc8e266e0814671642b74f3807affd27009fcc23f713ea92d1743e0ee0c1e7603": "0x0000000000000000000000000000000000000000000000000000000000000001",
88
- "0x3412d5605ac6cd444957cedb533e5dacad6378b4bc819ebe3652188a665066d6": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5",
89
- "0x9b3efc411c5f69533db363941e091f6f3af8b7e306525413577a56d27e5dbe73": "0x0000000000000000000000000000000000000000000000000000000000000001",
90
- "0xdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d706a": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5",
91
- "0xa2001bdd6a5944149e83176d089ee9a8246bd56aecf38fe4d6c66f5fbac18675": "0x0000000000000000000000000000000000000000000000000000000000000001",
92
- "0xc3ad33e20b0c56a223ad5104fff154aa010f8715b9c981fd38fdc60a4d1a52fc": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5"
93
- }
94
- },
95
- {
96
- "accountName": "keyless Deployer",
97
- "balance": "0",
98
- "nonce": "1",
99
- "address": "0x1754175c450BEbB9B6E14dEe542649c0402A25d2"
100
- },
101
- {
102
- "accountName": "deployer",
103
- "balance": "100000000000000000000000",
104
- "nonce": "8",
105
- "address": "0xff6250d0E86A2465B0C1bF8e36409503d6a26963"
106
- }
107
- ]
108
- }
109
- `
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
{/home/stefan/go/src/Polygon/zkevm-node → .}/config/config.go RENAMED
@@ -2,6 +2,8 @@
2
 
3
  import (
4
  "bytes"
 
 
5
  "path/filepath"
6
  "strings"
7
 
@@ -21,6 +24,7 @@
21
  "github.com/0xPolygonHermez/zkevm-node/state"
22
  "github.com/0xPolygonHermez/zkevm-node/state/runtime/executor"
23
  "github.com/0xPolygonHermez/zkevm-node/synchronizer"
 
24
  "github.com/mitchellh/mapstructure"
25
  "github.com/spf13/viper"
26
  "github.com/urfave/cli/v2"
@@ -31,7 +35,7 @@
31
  FlagYes = "yes"
32
  // FlagCfg is the flag for cfg.
33
  FlagCfg = "cfg"
34
- // FlagNetwork is the flag for the network name. Valid values: ["testnet", "mainnet", "cardona", "custom"].
35
  FlagNetwork = "network"
36
  // FlagCustomNetwork is the flag for the custom network file. This is required if --network=custom
37
  FlagCustomNetwork = "custom-network-file"
@@ -183,3 +187,19 @@
183
  }
184
  return cfg, nil
185
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  import (
4
  "bytes"
5
+ "crypto/ecdsa"
6
+ "os"
7
  "path/filepath"
8
  "strings"
9
 
 
24
  "github.com/0xPolygonHermez/zkevm-node/state"
25
  "github.com/0xPolygonHermez/zkevm-node/state/runtime/executor"
26
  "github.com/0xPolygonHermez/zkevm-node/synchronizer"
27
+ "github.com/ethereum/go-ethereum/accounts/keystore"
28
  "github.com/mitchellh/mapstructure"
29
  "github.com/spf13/viper"
30
  "github.com/urfave/cli/v2"
 
35
  FlagYes = "yes"
36
  // FlagCfg is the flag for cfg.
37
  FlagCfg = "cfg"
38
+ // FlagNetwork is the flag for the network name. Valid values: ["custom"].
39
  FlagNetwork = "network"
40
  // FlagCustomNetwork is the flag for the custom network file. This is required if --network=custom
41
  FlagCustomNetwork = "custom-network-file"
 
187
  }
188
  return cfg, nil
189
  }
190
+
191
+ // NewKeyFromKeystore creates a private key from a keystore file
192
+ func NewKeyFromKeystore(cfg types.KeystoreFileConfig) (*ecdsa.PrivateKey, error) {
193
+ if cfg.Path == "" && cfg.Password == "" {
194
+ return nil, nil
195
+ }
196
+ keystoreEncrypted, err := os.ReadFile(filepath.Clean(cfg.Path))
197
+ if err != nil {
198
+ return nil, err
199
+ }
200
+ key, err := keystore.DecryptKey(keystoreEncrypted, cfg.Password)
201
+ if err != nil {
202
+ return nil, err
203
+ }
204
+ return key.PrivateKey, nil
205
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/config/config_test.go RENAMED
@@ -53,10 +53,6 @@
53
  expectedValue: uint64(25),
54
  },
55
  {
56
- path: "Synchronizer.L2Synchronization.AcceptEmptyClosedBatches",
57
- expectedValue: false,
58
- },
59
- {
60
  path: "Sequencer.DeletePoolTxsL1BlockConfirmations",
61
  expectedValue: uint64(100),
62
  },
@@ -157,24 +153,28 @@
157
  expectedValue: uint64(80000),
158
  },
159
  {
 
 
 
 
160
  path: "Etherman.URL",
161
  expectedValue: "http://localhost:8545",
162
  },
163
  {
164
  path: "NetworkConfig.L1Config.L1ChainID",
165
- expectedValue: uint64(5),
166
  },
167
  {
168
  path: "NetworkConfig.L1Config.ZkEVMAddr",
169
- expectedValue: common.HexToAddress("0xa997cfD539E703921fD1e3Cf25b4c241a27a4c7A"),
170
  },
171
  {
172
  path: "NetworkConfig.L1Config.PolAddr",
173
- expectedValue: common.HexToAddress("0x1319D23c2F7034F52Eb07399702B040bA278Ca49"),
174
  },
175
  {
176
  path: "NetworkConfig.L1Config.GlobalExitRootManagerAddr",
177
- expectedValue: common.HexToAddress("0x4d9427DCA0406358445bC0a8F88C26b704004f74"),
178
  },
179
  {
180
  path: "Etherman.MultiGasProvider",
@@ -530,7 +530,8 @@
530
  require.NoError(t, os.WriteFile(file.Name(), []byte("{}"), 0600))
531
 
532
  flagSet := flag.NewFlagSet("", flag.PanicOnError)
533
- flagSet.String(config.FlagNetwork, "testnet", "")
 
534
  ctx := cli.NewContext(cli.NewApp(), flagSet, nil)
535
  cfg, err := config.Load(ctx, true)
536
  if err != nil {
@@ -568,7 +569,8 @@
568
  }()
569
  require.NoError(t, os.WriteFile(file.Name(), []byte("{}"), 0600))
570
  flagSet := flag.NewFlagSet("", flag.PanicOnError)
571
- flagSet.String(config.FlagNetwork, "testnet", "")
 
572
  ctx := cli.NewContext(cli.NewApp(), flagSet, nil)
573
 
574
  os.Setenv("ZKEVM_NODE_LOG_OUTPUTS", "a,b,c")
 
53
  expectedValue: uint64(25),
54
  },
55
  {
 
 
 
 
56
  path: "Sequencer.DeletePoolTxsL1BlockConfirmations",
57
  expectedValue: uint64(100),
58
  },
 
153
  expectedValue: uint64(80000),
154
  },
155
  {
156
+ path: "SequenceSender.MaxBatchesForL1",
157
+ expectedValue: uint64(300),
158
+ },
159
+ {
160
  path: "Etherman.URL",
161
  expectedValue: "http://localhost:8545",
162
  },
163
  {
164
  path: "NetworkConfig.L1Config.L1ChainID",
165
+ expectedValue: uint64(1337),
166
  },
167
  {
168
  path: "NetworkConfig.L1Config.ZkEVMAddr",
169
+ expectedValue: common.HexToAddress("0x8dAF17A20c9DBA35f005b6324F493785D239719d"),
170
  },
171
  {
172
  path: "NetworkConfig.L1Config.PolAddr",
173
+ expectedValue: common.HexToAddress("0x5FbDB2315678afecb367f032d93F642f64180aa3"),
174
  },
175
  {
176
  path: "NetworkConfig.L1Config.GlobalExitRootManagerAddr",
177
+ expectedValue: common.HexToAddress("0x8A791620dd6260079BF849Dc5567aDC3F2FdC318"),
178
  },
179
  {
180
  path: "Etherman.MultiGasProvider",
 
530
  require.NoError(t, os.WriteFile(file.Name(), []byte("{}"), 0600))
531
 
532
  flagSet := flag.NewFlagSet("", flag.PanicOnError)
533
+ flagSet.String(config.FlagNetwork, "custom", "")
534
+ flagSet.String(config.FlagCustomNetwork, "../test/config/test.genesis.config.json", "")
535
  ctx := cli.NewContext(cli.NewApp(), flagSet, nil)
536
  cfg, err := config.Load(ctx, true)
537
  if err != nil {
 
569
  }()
570
  require.NoError(t, os.WriteFile(file.Name(), []byte("{}"), 0600))
571
  flagSet := flag.NewFlagSet("", flag.PanicOnError)
572
+ flagSet.String(config.FlagNetwork, "custom", "")
573
+ flagSet.String(config.FlagCustomNetwork, "../test/config/test.genesis.config.json", "")
574
  ctx := cli.NewContext(cli.NewApp(), flagSet, nil)
575
 
576
  os.Setenv("ZKEVM_NODE_LOG_OUTPUTS", "a,b,c")
{/home/stefan/go/src/Polygon/zkevm-node → .}/config/default.go RENAMED
@@ -116,8 +116,6 @@
116
  [Synchronizer.L1ParallelSynchronization.PerformanceWarning]
117
  AceptableInacctivityTime = "5s"
118
  ApplyAfterNumRollupReceived = 10
119
- [Synchronizer.L2Synchronization]
120
- AcceptEmptyClosedBatches = false
121
 
122
  [Sequencer]
123
  DeletePoolTxsL1BlockConfirmations = 100
@@ -153,6 +151,7 @@
153
  L2Coinbase = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"
154
  PrivateKey = {Path = "/pk/sequencer.keystore", Password = "testonly"}
155
  GasOffset = 80000
 
156
 
157
  [Aggregator]
158
  Host = "0.0.0.0"
@@ -166,6 +165,10 @@
166
  GeneratingProofCleanupThreshold = "10m"
167
  GasOffset = 0
168
  UpgradeEtrogBatchNumber = 0
 
 
 
 
169
  BatchProofL1BlockConfirmations = 2
170
 
171
  [L2GasPriceSuggester]
 
116
  [Synchronizer.L1ParallelSynchronization.PerformanceWarning]
117
  AceptableInacctivityTime = "5s"
118
  ApplyAfterNumRollupReceived = 10
 
 
119
 
120
  [Sequencer]
121
  DeletePoolTxsL1BlockConfirmations = 100
 
151
  L2Coinbase = "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266"
152
  PrivateKey = {Path = "/pk/sequencer.keystore", Password = "testonly"}
153
  GasOffset = 80000
154
+ MaxBatchesForL1 = 300
155
 
156
  [Aggregator]
157
  Host = "0.0.0.0"
 
165
  GeneratingProofCleanupThreshold = "10m"
166
  GasOffset = 0
167
  UpgradeEtrogBatchNumber = 0
168
+ SettlementBackend = "agglayer"
169
+ AggLayerTxTimeout = "5m"
170
+ AggLayerURL = "http://zkevm-agglayer"
171
+ SequencerPrivateKey = {Path = "/pk/sequencer.keystore", Password = "testonly"}
172
  BatchProofL1BlockConfirmations = 2
173
 
174
  [L2GasPriceSuggester]
{/home/stefan/go/src/Polygon/zkevm-node → .}/config/mainnetgenesis.go RENAMED
@@ -1,107 +0,0 @@
1
- package config
2
-
3
- // MainnetNetworkConfigJSON is the hardcoded network configuration to be used for the official mainnet setup
4
- const MainnetNetworkConfigJSON = `
5
- {
6
- "l1Config" : {
7
- "chainId": 1,
8
- "polygonZkEVMAddress": "0x5132A183E9F3CB7C848b0AAC5Ae0c4f0491B7aB2",
9
- "polTokenAddress": "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0",
10
- "polygonZkEVMGlobalExitRootAddress": "0x580bda1e7A0CFAe92Fa7F6c20A3794F169CE3CFb"
11
- },
12
- "root": "0x3f86b09b43e3e49a41fc20a07579b79eba044253367817d5c241d23c0e2bc5c9",
13
- "genesisBlockNumber": 16896721,
14
- "genesis": [
15
- {
16
- "contractName": "PolygonZkEVMDeployer",
17
- "balance": "0",
18
- "nonce": "4",
19
- "address": "0xCB19eDdE626906eB1EE52357a27F62dd519608C2",
20
- "bytecode": "0x6080604052600436106100705760003560e01c8063715018a61161004e578063715018a6146100e65780638da5cb5b146100fb578063e11ae6cb14610126578063f2fde38b1461013957600080fd5b80632b79805a146100755780634a94d4871461008a5780636d07dbf81461009d575b600080fd5b610088610083366004610927565b610159565b005b6100886100983660046109c7565b6101cb565b3480156100a957600080fd5b506100bd6100b8366004610a1e565b61020d565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b50610088610220565b34801561010757600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100bd565b610088610134366004610a40565b610234565b34801561014557600080fd5b50610088610154366004610a90565b61029b565b610161610357565b600061016e8585856103d8565b905061017a8183610537565b5060405173ffffffffffffffffffffffffffffffffffffffff821681527fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a15050505050565b6101d3610357565b6101de83838361057b565b506040517f25adb19089b6a549831a273acdf7908cff8b7ee5f551f8d1d37996cf01c5df5b90600090a1505050565b600061021983836105a9565b9392505050565b610228610357565b61023260006105b6565b565b61023c610357565b60006102498484846103d8565b60405173ffffffffffffffffffffffffffffffffffffffff821681529091507fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a150505050565b6102a3610357565b73ffffffffffffffffffffffffffffffffffffffff811661034b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610354816105b6565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610232576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610342565b600083471015610444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e63650000006044820152606401610342565b81516000036104af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152606401610342565b8282516020840186f5905073ffffffffffffffffffffffffffffffffffffffff8116610219576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152606401610342565b6060610219838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c6564000081525061062b565b60606105a1848484604051806060016040528060298152602001610b3d6029913961062b565b949350505050565b6000610219838330610744565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060824710156106bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610342565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516106e69190610acf565b60006040518083038185875af1925050503d8060008114610723576040519150601f19603f3d011682016040523d82523d6000602084013e610728565b606091505b50915091506107398783838761076e565b979650505050505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b606083156108045782516000036107fd5773ffffffffffffffffffffffffffffffffffffffff85163b6107fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610342565b50816105a1565b6105a183838151156108195781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103429190610aeb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261088d57600080fd5b813567ffffffffffffffff808211156108a8576108a861084d565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156108ee576108ee61084d565b8160405283815286602085880101111561090757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806080858703121561093d57600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561096357600080fd5b61096f8883890161087c565b9350606087013591508082111561098557600080fd5b506109928782880161087c565b91505092959194509250565b803573ffffffffffffffffffffffffffffffffffffffff811681146109c257600080fd5b919050565b6000806000606084860312156109dc57600080fd5b6109e58461099e565b9250602084013567ffffffffffffffff811115610a0157600080fd5b610a0d8682870161087c565b925050604084013590509250925092565b60008060408385031215610a3157600080fd5b50508035926020909101359150565b600080600060608486031215610a5557600080fd5b8335925060208401359150604084013567ffffffffffffffff811115610a7a57600080fd5b610a868682870161087c565b9150509250925092565b600060208284031215610aa257600080fd5b6102198261099e565b60005b83811015610ac6578181015183820152602001610aae565b50506000910152565b60008251610ae1818460208701610aab565b9190910192915050565b6020815260008251806020840152610b0a816040850160208701610aab565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a26469706673582212203e70ce334e8ec9d8d03e87415afd36dce4e82633bd277b08937095a6bd66367764736f6c63430008110033",
21
- "storage": {
22
- "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000004c1665d6651ecefa59b9b3041951608468b18891"
23
- }
24
- },
25
- {
26
- "contractName": "ProxyAdmin",
27
- "balance": "0",
28
- "nonce": "1",
29
- "address": "0x0F99738B2Fc14D77308337f3e2596b63aE7BCC4A",
30
- "bytecode": "0x60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461012b57806399a88ec41461013e578063f2fde38b1461015e578063f3b7dead1461017e57600080fd5b8063204e1c7a14610080578063715018a6146100c95780637eff275e146100e05780638da5cb5b14610100575b600080fd5b34801561008c57600080fd5b506100a061009b366004610608565b61019e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100d557600080fd5b506100de610255565b005b3480156100ec57600080fd5b506100de6100fb36600461062c565b610269565b34801561010c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100a0565b6100de610139366004610694565b6102f7565b34801561014a57600080fd5b506100de61015936600461062c565b61038c565b34801561016a57600080fd5b506100de610179366004610608565b6103e8565b34801561018a57600080fd5b506100a0610199366004610608565b6104a4565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907f5c60da1b00000000000000000000000000000000000000000000000000000000815260040190565b600060405180830381855afa9150503d8060008114610225576040519150601f19603f3d011682016040523d82523d6000602084013e61022a565b606091505b50915091508161023957600080fd5b8080602001905181019061024d9190610788565b949350505050565b61025d6104f0565b6102676000610571565b565b6102716104f0565b6040517f8f28397000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690638f283970906024015b600060405180830381600087803b1580156102db57600080fd5b505af11580156102ef573d6000803e3d6000fd5b505050505050565b6102ff6104f0565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef28690349061035590869086906004016107a5565b6000604051808303818588803b15801561036e57600080fd5b505af1158015610382573d6000803e3d6000fd5b5050505050505050565b6103946104f0565b6040517f3659cfe600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690633659cfe6906024016102c1565b6103f06104f0565b73ffffffffffffffffffffffffffffffffffffffff8116610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6104a181610571565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907ff851a44000000000000000000000000000000000000000000000000000000000815260040190565b60005473ffffffffffffffffffffffffffffffffffffffff163314610267576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161048f565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff811681146104a157600080fd5b60006020828403121561061a57600080fd5b8135610625816105e6565b9392505050565b6000806040838503121561063f57600080fd5b823561064a816105e6565b9150602083013561065a816105e6565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156106a957600080fd5b83356106b4816105e6565b925060208401356106c4816105e6565b9150604084013567ffffffffffffffff808211156106e157600080fd5b818601915086601f8301126106f557600080fd5b81358181111561070757610707610665565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561074d5761074d610665565b8160405282815289602084870101111561076657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60006020828403121561079a57600080fd5b8151610625816105e6565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b818110156107ef578581018301518582016060015282016107d3565b5060006060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010192505050939250505056fea2646970667358221220372a0e10eebea1b7fa43ae4c976994e6ed01d85eedc3637b83f01d3f06be442064736f6c63430008110033",
31
- "storage": {
32
- "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000bba0935fa93eb23de7990b47f0d96a8f75766d13"
33
- }
34
- },
35
- {
36
- "contractName": "PolygonZkEVMBridge implementation",
37
- "balance": "0",
38
- "nonce": "1",
39
- "address": "0x5ac4182A1dd41AeEf465E40B82fd326BF66AB82C",
40
- "bytecode": "0x6080604052600436106200019f5760003560e01c8063647c576c11620000e7578063be5831c71162000089578063dbc169761162000060578063dbc169761462000639578063ee25560b1462000651578063fb570834146200068257600080fd5b8063be5831c714620005ae578063cd58657914620005ea578063d02103ca146200060157600080fd5b80639e34070f11620000be5780639e34070f146200050a578063aaa13cc2146200054f578063bab161bf146200057457600080fd5b8063647c576c146200048657806379e2cf9714620004ab57806381b1c17414620004c357600080fd5b80632d2c9d94116200015157806334ac9cf2116200012857806334ac9cf2146200034b5780633ae05047146200037a5780633e197043146200039257600080fd5b80632d2c9d9414620002765780632dfdf0b5146200029b578063318aee3d14620002c257600080fd5b806322e95f2c116200018657806322e95f2c14620001ef578063240ff378146200023a5780632cffd02e146200025157600080fd5b806315064c9614620001a45780632072f6c514620001d5575b600080fd5b348015620001b157600080fd5b50606854620001c09060ff1681565b60405190151581526020015b60405180910390f35b348015620001e257600080fd5b50620001ed620006a7565b005b348015620001fc57600080fd5b50620002146200020e366004620032db565b62000705565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001620001cc565b620001ed6200024b36600462003372565b620007a8565b3480156200025e57600080fd5b50620001ed6200027036600462003409565b620009d0565b3480156200028357600080fd5b50620001ed6200029536600462003409565b62000f74565b348015620002a857600080fd5b50620002b360535481565b604051908152602001620001cc565b348015620002cf57600080fd5b5062000319620002e1366004620034ef565b606b6020526000908152604090205463ffffffff811690640100000000900473ffffffffffffffffffffffffffffffffffffffff1682565b6040805163ffffffff909316835273ffffffffffffffffffffffffffffffffffffffff909116602083015201620001cc565b3480156200035857600080fd5b50606c54620002149073ffffffffffffffffffffffffffffffffffffffff1681565b3480156200038757600080fd5b50620002b362001178565b3480156200039f57600080fd5b50620002b3620003b136600462003526565b6040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b3480156200049357600080fd5b50620001ed620004a5366004620035b0565b6200125e565b348015620004b857600080fd5b50620001ed620014ad565b348015620004d057600080fd5b5062000214620004e236600462003600565b606a6020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200051757600080fd5b50620001c06200052936600462003600565b600881901c600090815260696020526040902054600160ff9092169190911b9081161490565b3480156200055c57600080fd5b50620002146200056e3660046200361a565b620014e7565b3480156200058157600080fd5b506068546200059890610100900463ffffffff1681565b60405163ffffffff9091168152602001620001cc565b348015620005bb57600080fd5b506068546200059890790100000000000000000000000000000000000000000000000000900463ffffffff1681565b620001ed620005fb366004620036ce565b620016d3565b3480156200060e57600080fd5b50606854620002149065010000000000900473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200064657600080fd5b50620001ed62001c37565b3480156200065e57600080fd5b50620002b36200067036600462003600565b60696020526000908152604090205481565b3480156200068f57600080fd5b50620001c0620006a136600462003770565b62001c93565b606c5473ffffffffffffffffffffffffffffffffffffffff163314620006f9576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362001d7c565b565b6040805160e084901b7fffffffff0000000000000000000000000000000000000000000000000000000016602080830191909152606084901b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602483015282516018818403018152603890920183528151918101919091206000908152606a909152205473ffffffffffffffffffffffffffffffffffffffff165b92915050565b60685460ff1615620007e6576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff8681166101009092041614806200080c5750600263ffffffff861610155b1562000844576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b6001606860019054906101000a900463ffffffff163388883488886053546040516200089a9998979695949392919062003806565b60405180910390a1620009b8620009b26001606860019054906101000a900463ffffffff16338989348989604051620008d592919062003881565b60405180910390206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b62001e10565b8215620009c957620009c962001f27565b5050505050565b60685460ff161562000a0e576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000a258b8b8b8b8b8b8b8b8b8b8b600062001ffc565b73ffffffffffffffffffffffffffffffffffffffff861662000b01576040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff861690859060405162000a7a9190620038e6565b60006040518083038185875af1925050503d806000811462000ab9576040519150601f19603f3d011682016040523d82523d6000602084013e62000abe565b606091505b505090508062000afa576040517f6747a28800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5062000efc565b60685463ffffffff61010090910481169088160362000b435762000b3d73ffffffffffffffffffffffffffffffffffffffff87168585620021ed565b62000efc565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b166024820152600090603801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000818152606a90935291205490915073ffffffffffffffffffffffffffffffffffffffff168062000e6e576000808062000c1886880188620039fb565b92509250925060008584848460405162000c329062003292565b62000c409392919062003abd565b8190604051809103906000f590508015801562000c61573d6000803e3d6000fd5b506040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c81166004830152602482018c9052919250908216906340c10f1990604401600060405180830381600087803b15801562000cd757600080fd5b505af115801562000cec573d6000803e3d6000fd5b5050505080606a600088815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060405180604001604052808e63ffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff16815250606b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050507f490e59a1701b938786ac72570a1efeac994a3dbe96e2e883e19e902ace6e6a398d8d838b8b60405162000e5c95949392919062003afa565b60405180910390a15050505062000ef9565b6040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018790528216906340c10f1990604401600060405180830381600087803b15801562000edf57600080fd5b505af115801562000ef4573d6000803e3d6000fd5b505050505b50505b6040805163ffffffff8c811682528916602082015273ffffffffffffffffffffffffffffffffffffffff88811682840152861660608201526080810185905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a15050505050505050505050565b60685460ff161562000fb2576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000fc98b8b8b8b8b8b8b8b8b8b8b600162001ffc565b60008473ffffffffffffffffffffffffffffffffffffffff1684888a868660405160240162000ffc949392919062003b42565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1806b5f200000000000000000000000000000000000000000000000000000000179052516200107f9190620038e6565b60006040518083038185875af1925050503d8060008114620010be576040519150601f19603f3d011682016040523d82523d6000602084013e620010c3565b606091505b5050905080620010ff576040517f37e391c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805163ffffffff8d811682528a16602082015273ffffffffffffffffffffffffffffffffffffffff89811682840152871660608201526080810186905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a1505050505050505050505050565b605354600090819081805b602081101562001255578083901c600116600103620011e65760338160208110620011b257620011b262003b8a565b0154604080516020810192909252810185905260600160405160208183030381529060405280519060200120935062001213565b60408051602081018690529081018390526060016040516020818303038152906040528051906020012093505b604080516020810184905290810183905260600160405160208183030381529060405280519060200120915080806200124c9062003be8565b91505062001183565b50919392505050565b600054610100900460ff16158080156200127f5750600054600160ff909116105b806200129b5750303b1580156200129b575060005460ff166001145b6200132d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156200138c57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b606880547fffffffffffffff000000000000000000000000000000000000000000000000ff1661010063ffffffff8716027fffffffffffffff0000000000000000000000000000000000000000ffffffffff16176501000000000073ffffffffffffffffffffffffffffffffffffffff8681169190910291909117909155606c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001691841691909117905562001443620022c3565b8015620014a757600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b605354606854790100000000000000000000000000000000000000000000000000900463ffffffff16101562000703576200070362001f27565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b1660248201526000908190603801604051602081830303815290604052805190602001209050600060ff60f81b3083604051806020016200157d9062003292565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820381018352601f909101166040819052620015c8908d908d908d908d908d9060200162003c23565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905262001606929160200162003c64565b604051602081830303815290604052805190602001206040516020016200168f94939291907fff0000000000000000000000000000000000000000000000000000000000000094909416845260609290921b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660018401526015830152603582015260550190565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815291905280516020909101209a9950505050505050505050565b60685460ff161562001711576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200171b62002366565b60685463ffffffff888116610100909204161480620017415750600263ffffffff881610155b1562001779576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060608773ffffffffffffffffffffffffffffffffffffffff8816620017df57883414620017d5576040517fb89240f500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000925062001ad9565b341562001818576040517f798ee6f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8089166000908152606b602090815260409182902082518084019093525463ffffffff811683526401000000009004909216918101829052901562001908576040517f9dc29fac000000000000000000000000000000000000000000000000000000008152336004820152602481018b905273ffffffffffffffffffffffffffffffffffffffff8a1690639dc29fac90604401600060405180830381600087803b158015620018db57600080fd5b505af1158015620018f0573d6000803e3d6000fd5b50505050806020015194508060000151935062001ad7565b85156200191d576200191d898b8989620023db565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8b16906370a0823190602401602060405180830381865afa1580156200198b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620019b1919062003c97565b9050620019d773ffffffffffffffffffffffffffffffffffffffff8b1633308e620028f9565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa15801562001a45573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001a6b919062003c97565b905062001a79828262003cb1565b6068548c9850610100900463ffffffff169650935062001a998762002959565b62001aa48c62002a71565b62001aaf8d62002b7e565b60405160200162001ac39392919062003abd565b604051602081830303815290604052945050505b505b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b600084868e8e868860535460405162001b1b98979695949392919062003cc7565b60405180910390a162001c0f620009b2600085878f8f8789805190602001206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b861562001c205762001c2062001f27565b5050505062001c2e60018055565b50505050505050565b606c5473ffffffffffffffffffffffffffffffffffffffff16331462001c89576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362002c80565b600084815b602081101562001d6e57600163ffffffff8616821c8116900362001d0a5785816020811062001ccb5762001ccb62003b8a565b60200201358260405160200162001cec929190918252602082015260400190565b60405160208183030381529060405280519060200120915062001d59565b8186826020811062001d205762001d2062003b8a565b602002013560405160200162001d40929190918252602082015260400190565b6040516020818303038152906040528051906020012091505b8062001d658162003be8565b91505062001c98565b50821490505b949350505050565b60685460ff161562001dba576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556040517f2261efe5aef6fedc1fd1550b25facc9181745623049c7901287030b9ad1a549790600090a1565b80600162001e216020600262003e79565b62001e2d919062003cb1565b6053541062001e68576040517fef5ccf6600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060536000815462001e7b9062003be8565b9182905550905060005b602081101562001f17578082901c60011660010362001ebd57826033826020811062001eb55762001eb562003b8a565b015550505050565b6033816020811062001ed35762001ed362003b8a565b01546040805160208101929092528101849052606001604051602081830303815290604052805190602001209250808062001f0e9062003be8565b91505062001e85565b5062001f2262003e87565b505050565b6053546068805463ffffffff909216790100000000000000000000000000000000000000000000000000027fffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffff909216919091179081905573ffffffffffffffffffffffffffffffffffffffff65010000000000909104166333d6247d62001fad62001178565b6040518263ffffffff1660e01b815260040162001fcc91815260200190565b600060405180830381600087803b15801562001fe757600080fd5b505af1158015620014a7573d6000803e3d6000fd5b6200200d8b63ffffffff1662002d10565b6068546040805160208082018e90528183018d9052825180830384018152606083019384905280519101207f257b363200000000000000000000000000000000000000000000000000000000909252606481019190915260009165010000000000900473ffffffffffffffffffffffffffffffffffffffff169063257b3632906084016020604051808303816000875af1158015620020b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620020d6919062003c97565b90508060000362002112576040517e2f6fad00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff88811661010090920416146200215c576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606854600090610100900463ffffffff166200217a5750896200217d565b508a5b620021a66200219d848c8c8c8c8c8c8c604051620008d592919062003881565b8f8f8462001c93565b620021dd576040517fe0417cec00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905262001f229084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262002d75565b600054610100900460ff166200235c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6200070362002e88565b600260015403620023d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640162001324565b6002600155565b6000620023ec600482848662003eb6565b620023f79162003ee2565b90507f2afa5331000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000821601620026765760008080808080806200245a896004818d62003eb6565b81019062002469919062003f2b565b96509650965096509650965096503373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614620024dd576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff861630146200252d576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8a851462002567576040517f03fffc4b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff89811660248301528881166044830152606482018890526084820187905260ff861660a483015260c4820185905260e48083018590528351808403909101815261010490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fd505accf000000000000000000000000000000000000000000000000000000001790529151918e1691620026229190620038e6565b6000604051808303816000865af19150503d806000811462002661576040519150601f19603f3d011682016040523d82523d6000602084013e62002666565b606091505b50505050505050505050620009c9565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f8fcbaf0c0000000000000000000000000000000000000000000000000000000014620026f2576040517fe282c0ba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080808080806200270a8a6004818e62003eb6565b81019062002719919062003f86565b975097509750975097509750975097503373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16146200278f576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff87163014620027df576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8a811660248301528981166044830152606482018990526084820188905286151560a483015260ff861660c483015260e482018590526101048083018590528351808403909101815261012490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f8fcbaf0c000000000000000000000000000000000000000000000000000000001790529151918f1691620028a39190620038e6565b6000604051808303816000865af19150503d8060008114620028e2576040519150601f19603f3d011682016040523d82523d6000602084013e620028e7565b606091505b50505050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052620014a79085907f23b872dd000000000000000000000000000000000000000000000000000000009060840162002240565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f06fdde03000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff861691620029dd9190620038e6565b600060405180830381855afa9150503d806000811462002a1a576040519150601f19603f3d011682016040523d82523d6000602084013e62002a1f565b606091505b50915091508162002a66576040518060400160405280600781526020017f4e4f5f4e414d450000000000000000000000000000000000000000000000000081525062001d74565b62001d748162002f21565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f95d89b41000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff86169162002af59190620038e6565b600060405180830381855afa9150503d806000811462002b32576040519150601f19603f3d011682016040523d82523d6000602084013e62002b37565b606091505b50915091508162002a66576040518060400160405280600981526020017f4e4f5f53594d424f4c000000000000000000000000000000000000000000000081525062001d74565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f313ce5670000000000000000000000000000000000000000000000000000000017905290516000918291829173ffffffffffffffffffffffffffffffffffffffff86169162002c019190620038e6565b600060405180830381855afa9150503d806000811462002c3e576040519150601f19603f3d011682016040523d82523d6000602084013e62002c43565b606091505b509150915081801562002c57575080516020145b62002c6457601262001d74565b8080602001905181019062001d74919062004012565b60018055565b60685460ff1662002cbd576040517f5386698100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040517f1e5e34eea33501aecf2ebec9fe0e884a40804275ea7fe10b2ba084c8374308b390600090a1565b600881901c60008181526069602052604081208054600160ff861690811b91821892839055929091908183169003620009c9576040517f646cf55800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600062002dd9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16620031119092919063ffffffff16565b80519091501562001f22578080602001905181019062002dfa919062004032565b62001f22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840162001324565b600054610100900460ff1662002c7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6060604082511062002f435781806020019051810190620007a2919062004052565b8151602003620030d35760005b60208110801562002f9b575082818151811062002f715762002f7162003b8a565b01602001517fff000000000000000000000000000000000000000000000000000000000000001615155b1562002fb6578062002fad8162003be8565b91505062002f50565b8060000362002ffa57505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e4700000000000000000000000000006020820152919050565b60008167ffffffffffffffff81111562003018576200301862003891565b6040519080825280601f01601f19166020018201604052801562003043576020820181803683370190505b50905060005b82811015620030cb5784818151811062003067576200306762003b8a565b602001015160f81c60f81b82828151811062003087576200308762003b8a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080620030c28162003be8565b91505062003049565b509392505050565b505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e470000000000000000000000000000602082015290565b919050565b606062001d748484600085856000808673ffffffffffffffffffffffffffffffffffffffff168587604051620031489190620038e6565b60006040518083038185875af1925050503d806000811462003187576040519150601f19603f3d011682016040523d82523d6000602084013e6200318c565b606091505b50915091506200319f87838387620031aa565b979650505050505050565b60608315620032455782516000036200323d5773ffffffffffffffffffffffffffffffffffffffff85163b6200323d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162001324565b508162001d74565b62001d7483838151156200325c5781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620013249190620040d2565b611b6680620040e883390190565b803563ffffffff811681146200310c57600080fd5b73ffffffffffffffffffffffffffffffffffffffff81168114620032d857600080fd5b50565b60008060408385031215620032ef57600080fd5b620032fa83620032a0565b915060208301356200330c81620032b5565b809150509250929050565b8015158114620032d857600080fd5b60008083601f8401126200333957600080fd5b50813567ffffffffffffffff8111156200335257600080fd5b6020830191508360208285010111156200336b57600080fd5b9250929050565b6000806000806000608086880312156200338b57600080fd5b6200339686620032a0565b94506020860135620033a881620032b5565b93506040860135620033ba8162003317565b9250606086013567ffffffffffffffff811115620033d757600080fd5b620033e58882890162003326565b969995985093965092949392505050565b806104008101831015620007a257600080fd5b60008060008060008060008060008060006105208c8e0312156200342c57600080fd5b620034388d8d620033f6565b9a50620034496104008d01620032a0565b99506104208c013598506104408c013597506200346a6104608d01620032a0565b96506104808c01356200347d81620032b5565b95506200348e6104a08d01620032a0565b94506104c08c0135620034a181620032b5565b93506104e08c013592506105008c013567ffffffffffffffff811115620034c757600080fd5b620034d58e828f0162003326565b915080935050809150509295989b509295989b9093969950565b6000602082840312156200350257600080fd5b81356200350f81620032b5565b9392505050565b60ff81168114620032d857600080fd5b600080600080600080600060e0888a0312156200354257600080fd5b87356200354f8162003516565b96506200355f60208901620032a0565b955060408801356200357181620032b5565b94506200358160608901620032a0565b935060808801356200359381620032b5565b9699959850939692959460a0840135945060c09093013592915050565b600080600060608486031215620035c657600080fd5b620035d184620032a0565b92506020840135620035e381620032b5565b91506040840135620035f581620032b5565b809150509250925092565b6000602082840312156200361357600080fd5b5035919050565b600080600080600080600060a0888a0312156200363657600080fd5b6200364188620032a0565b965060208801356200365381620032b5565b9550604088013567ffffffffffffffff808211156200367157600080fd5b6200367f8b838c0162003326565b909750955060608a01359150808211156200369957600080fd5b50620036a88a828b0162003326565b9094509250506080880135620036be8162003516565b8091505092959891949750929550565b600080600080600080600060c0888a031215620036ea57600080fd5b620036f588620032a0565b965060208801356200370781620032b5565b95506040880135945060608801356200372081620032b5565b93506080880135620037328162003317565b925060a088013567ffffffffffffffff8111156200374f57600080fd5b6200375d8a828b0162003326565b989b979a50959850939692959293505050565b60008060008061046085870312156200378857600080fd5b843593506200379b8660208701620033f6565b9250620037ac6104208601620032a0565b939692955092936104400135925050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b600061010060ff8c16835263ffffffff808c16602085015273ffffffffffffffffffffffffffffffffffffffff808c166040860152818b166060860152808a166080860152508760a08501528160c0850152620038678285018789620037bd565b925080851660e085015250509a9950505050505050505050565b8183823760009101908152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60005b83811015620038dd578181015183820152602001620038c3565b50506000910152565b60008251620038fa818460208701620038c0565b9190910192915050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156200394e576200394e62003891565b604052919050565b600067ffffffffffffffff82111562003973576200397362003891565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112620039b157600080fd5b8135620039c8620039c28262003956565b62003904565b818152846020838601011115620039de57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121562003a1157600080fd5b833567ffffffffffffffff8082111562003a2a57600080fd5b62003a38878388016200399f565b9450602086013591508082111562003a4f57600080fd5b5062003a5e868287016200399f565b9250506040840135620035f58162003516565b6000815180845262003a8b816020860160208601620038c0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60608152600062003ad2606083018662003a71565b828103602084015262003ae6818662003a71565b91505060ff83166040830152949350505050565b63ffffffff86168152600073ffffffffffffffffffffffffffffffffffffffff8087166020840152808616604084015250608060608301526200319f608083018486620037bd565b73ffffffffffffffffffffffffffffffffffffffff8516815263ffffffff8416602082015260606040820152600062003b80606083018486620037bd565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820362003c1c5762003c1c62003bb9565b5060010190565b60608152600062003c39606083018789620037bd565b828103602084015262003c4e818688620037bd565b91505060ff831660408301529695505050505050565b6000835162003c78818460208801620038c0565b83519083019062003c8e818360208801620038c0565b01949350505050565b60006020828403121562003caa57600080fd5b5051919050565b81810381811115620007a257620007a262003bb9565b600061010060ff8b16835263ffffffff808b16602085015273ffffffffffffffffffffffffffffffffffffffff808b166040860152818a1660608601528089166080860152508660a08501528160c085015262003d278285018762003a71565b925080851660e085015250509998505050505050505050565b600181815b8085111562003d9f57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003d835762003d8362003bb9565b8085161562003d9157918102915b93841c939080029062003d45565b509250929050565b60008262003db857506001620007a2565b8162003dc757506000620007a2565b816001811462003de0576002811462003deb5762003e0b565b6001915050620007a2565b60ff84111562003dff5762003dff62003bb9565b50506001821b620007a2565b5060208310610133831016604e8410600b841016171562003e30575081810a620007a2565b62003e3c838362003d40565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003e715762003e7162003bb9565b029392505050565b60006200350f838362003da7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b6000808585111562003ec757600080fd5b8386111562003ed557600080fd5b5050820193919092039150565b7fffffffff00000000000000000000000000000000000000000000000000000000813581811691600485101562003f235780818660040360031b1b83161692505b505092915050565b600080600080600080600060e0888a03121562003f4757600080fd5b873562003f5481620032b5565b9650602088013562003f6681620032b5565b955060408801359450606088013593506080880135620035938162003516565b600080600080600080600080610100898b03121562003fa457600080fd5b883562003fb181620032b5565b9750602089013562003fc381620032b5565b96506040890135955060608901359450608089013562003fe38162003317565b935060a089013562003ff58162003516565b979a969950949793969295929450505060c08201359160e0013590565b6000602082840312156200402557600080fd5b81516200350f8162003516565b6000602082840312156200404557600080fd5b81516200350f8162003317565b6000602082840312156200406557600080fd5b815167ffffffffffffffff8111156200407d57600080fd5b8201601f810184136200408f57600080fd5b8051620040a0620039c28262003956565b818152856020838501011115620040b657600080fd5b620040c9826020830160208601620038c0565b95945050505050565b6020815260006200350f602083018462003a7156fe6101006040523480156200001257600080fd5b5060405162001b6638038062001b6683398101604081905262000035916200028d565b82826003620000458382620003a1565b506004620000548282620003a1565b50503360c0525060ff811660e052466080819052620000739062000080565b60a052506200046d915050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620000ad6200012e565b805160209182012060408051808201825260018152603160f81b90840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b6060600380546200013f9062000312565b80601f01602080910402602001604051908101604052809291908181526020018280546200016d9062000312565b8015620001be5780601f106200019257610100808354040283529160200191620001be565b820191906000526020600020905b815481529060010190602001808311620001a057829003601f168201915b5050505050905090565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001f057600080fd5b81516001600160401b03808211156200020d576200020d620001c8565b604051601f8301601f19908116603f01168101908282118183101715620002385762000238620001c8565b816040528381526020925086838588010111156200025557600080fd5b600091505b838210156200027957858201830151818301840152908201906200025a565b600093810190920192909252949350505050565b600080600060608486031215620002a357600080fd5b83516001600160401b0380821115620002bb57600080fd5b620002c987838801620001de565b94506020860151915080821115620002e057600080fd5b50620002ef86828701620001de565b925050604084015160ff811681146200030757600080fd5b809150509250925092565b600181811c908216806200032757607f821691505b6020821081036200034857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200039c57600081815260208120601f850160051c81016020861015620003775750805b601f850160051c820191505b81811015620003985782815560010162000383565b5050505b505050565b81516001600160401b03811115620003bd57620003bd620001c8565b620003d581620003ce845462000312565b846200034e565b602080601f8311600181146200040d5760008415620003f45750858301515b600019600386901b1c1916600185901b17855562000398565b600085815260208120601f198616915b828110156200043e578886015182559484019460019091019084016200041d565b50858210156200045d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e0516116aa620004bc6000396000610237015260008181610307015281816105c001526106a70152600061053a015260008181610379015261050401526116aa6000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806370a08231116100d8578063a457c2d71161008c578063d505accf11610066578063d505accf1461039b578063dd62ed3e146103ae578063ffa1ad74146103f457600080fd5b8063a457c2d71461034e578063a9059cbb14610361578063cd0d00961461037457600080fd5b806395d89b41116100bd57806395d89b41146102e75780639dc29fac146102ef578063a3c573eb1461030257600080fd5b806370a08231146102915780637ecebe00146102c757600080fd5b806330adf81f1161012f5780633644e515116101145780633644e51514610261578063395093511461026957806340c10f191461027c57600080fd5b806330adf81f14610209578063313ce5671461023057600080fd5b806318160ddd1161016057806318160ddd146101bd57806320606b70146101cf57806323b872dd146101f657600080fd5b806306fdde031461017c578063095ea7b31461019a575b600080fd5b610184610430565b60405161019191906113e4565b60405180910390f35b6101ad6101a8366004611479565b6104c2565b6040519015158152602001610191565b6002545b604051908152602001610191565b6101c17f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b6101ad6102043660046114a3565b6104dc565b6101c17f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610191565b6101c1610500565b6101ad610277366004611479565b61055c565b61028f61028a366004611479565b6105a8565b005b6101c161029f3660046114df565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6101c16102d53660046114df565b60056020526000908152604090205481565b610184610680565b61028f6102fd366004611479565b61068f565b6103297f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610191565b6101ad61035c366004611479565b61075e565b6101ad61036f366004611479565b61082f565b6101c17f000000000000000000000000000000000000000000000000000000000000000081565b61028f6103a9366004611501565b61083d565b6101c16103bc366004611574565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6101846040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b60606003805461043f906115a7565b80601f016020809104026020016040519081016040528092919081815260200182805461046b906115a7565b80156104b85780601f1061048d576101008083540402835291602001916104b8565b820191906000526020600020905b81548152906001019060200180831161049b57829003601f168201915b5050505050905090565b6000336104d0818585610b73565b60019150505b92915050565b6000336104ea858285610d27565b6104f5858585610dfe565b506001949350505050565b60007f00000000000000000000000000000000000000000000000000000000000000004614610537576105324661106d565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906104d090829086906105a3908790611629565b610b73565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610672576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d4272696467650000000000000000000000000000000060648201526084015b60405180910390fd5b61067c8282611135565b5050565b60606004805461043f906115a7565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610754576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d427269646765000000000000000000000000000000006064820152608401610669565b61067c8282611228565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610669565b6104f58286868403610b73565b6000336104d0818585610dfe565b834211156108cc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f546f6b656e577261707065643a3a7065726d69743a204578706972656420706560448201527f726d6974000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260056020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a9190866109268361163c565b9091555060408051602081019690965273ffffffffffffffffffffffffffffffffffffffff94851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610991610500565b6040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281019190915260428101839052606201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015610a55573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590610ad057508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610b5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f546f6b656e577261707065643a3a7065726d69743a20496e76616c696420736960448201527f676e6174757265000000000000000000000000000000000000000000000000006064820152608401610669565b610b678a8a8a610b73565b50505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8316610c15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610cb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610df85781811015610deb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610669565b610df88484848403610b73565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610ea1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610f44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610ffa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610df8565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611098610430565b8051602091820120604080518082018252600181527f310000000000000000000000000000000000000000000000000000000000000090840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b73ffffffffffffffffffffffffffffffffffffffff82166111b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610669565b80600260008282546111c49190611629565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff82166112cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015611381576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610d1a565b600060208083528351808285015260005b81811015611411578581018301518582016040015282016113f5565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461147457600080fd5b919050565b6000806040838503121561148c57600080fd5b61149583611450565b946020939093013593505050565b6000806000606084860312156114b857600080fd5b6114c184611450565b92506114cf60208501611450565b9150604084013590509250925092565b6000602082840312156114f157600080fd5b6114fa82611450565b9392505050565b600080600080600080600060e0888a03121561151c57600080fd5b61152588611450565b965061153360208901611450565b95506040880135945060608801359350608088013560ff8116811461155757600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561158757600080fd5b61159083611450565b915061159e60208401611450565b90509250929050565b600181811c908216806115bb57607f821691505b6020821081036115f4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156104d6576104d66115fa565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361166d5761166d6115fa565b506001019056fea26469706673582212208d88fee561cff7120d381c345cfc534cef8229a272dc5809d4bbb685ad67141164736f6c63430008110033a2646970667358221220d9b3ca7b13ec80ac58634ddf0ecebe71e209a71f532614949b9e720413f50c8364736f6c63430008110033"
41
- },
42
- {
43
- "contractName": "PolygonZkEVMBridge proxy",
44
- "balance": "200000000000000000000000000",
45
- "nonce": "1",
46
- "address": "0x2a3DD3EB832aF982ec71669E178424b10Dca2EDe",
47
- "bytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461088b565b610135565b61006b6100a33660046108a6565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461088b565b610231565b34801561011257600080fd5b506100bd61025e565b6101236102d4565b61013361012e6103ab565b6103b5565b565b61013d6103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481604051806020016040528060008152506000610419565b50565b61017461011b565b6101876103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610419915050565b505050565b6101e661011b565b60006101fd6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103ab565b905090565b61022e61011b565b90565b6102396103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481610444565b60006102686103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103d9565b60606102b183836040518060600160405280602781526020016109bb602791396104a5565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6102dc6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b600061022161052a565b3660008037600080366000845af43d6000803e8080156103d4573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b61042283610552565b60008251118061042f5750805b156101e65761043e838361028c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61046d6103d9565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a16101748161059f565b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516104cf919061094d565b600060405180830381855af49150503d806000811461050a576040519150601f19603f3d011682016040523d82523d6000602084013e61050f565b606091505b5091509150610520868383876106ab565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103fd565b61055b81610753565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff8116610642576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103a2565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b6060831561074157825160000361073a5773ffffffffffffffffffffffffffffffffffffffff85163b61073a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103a2565b508161074b565b61074b838361081e565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff81163b6107f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016103a2565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610665565b81511561082e5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a29190610969565b803573ffffffffffffffffffffffffffffffffffffffff8116811461088657600080fd5b919050565b60006020828403121561089d57600080fd5b6102b182610862565b6000806000604084860312156108bb57600080fd5b6108c484610862565b9250602084013567ffffffffffffffff808211156108e157600080fd5b818601915086601f8301126108f557600080fd5b81358181111561090457600080fd5b87602082850101111561091657600080fd5b6020830194508093505050509250925092565b60005b8381101561094457818101518382015260200161092c565b50506000910152565b6000825161095f818460208701610929565b9190910192915050565b6020815260008251806020840152610988816040850160208701610929565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220a1af0d6cb4f1e31496a4c5c1448913bce4bd6ad3a39e47c6f7190c114d6f9bf464736f6c63430008110033",
48
- "storage": {
49
- "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000000000000000000000000000000000000000001",
50
- "0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000001",
51
- "0x0000000000000000000000000000000000000000000000000000000000000068": "0x00000000000000a40d5f56745a118d0906a34e69aec8c0db1cb8fa0000000100",
52
- "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x0000000000000000000000000f99738b2fc14d77308337f3e2596b63ae7bcc4a",
53
- "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x0000000000000000000000005ac4182a1dd41aeef465e40b82fd326bf66ab82c"
54
- }
55
- },
56
- {
57
- "contractName": "PolygonZkEVMGlobalExitRootL2 implementation",
58
- "balance": "0",
59
- "nonce": "1",
60
- "address": "0x0200143Fa295EE4dffEF22eE2616c2E008D81688",
61
- "bytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806301fd904414610051578063257b36321461006d57806333d6247d1461008d578063a3c573eb146100a2575b600080fd5b61005a60015481565b6040519081526020015b60405180910390f35b61005a61007b366004610162565b60006020819052908152604090205481565b6100a061009b366004610162565b6100ee565b005b6100c97f0000000000000000000000002a3dd3eb832af982ec71669e178424b10dca2ede81565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610064565b3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000002a3dd3eb832af982ec71669e178424b10dca2ede161461015d576040517fb49365dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600155565b60006020828403121561017457600080fd5b503591905056fea2646970667358221220a187fc278346c1b61c449ea3641002b6eac2bda3351a122a12c35099f933696864736f6c63430008110033"
62
- },
63
- {
64
- "contractName": "PolygonZkEVMGlobalExitRootL2 proxy",
65
- "balance": "0",
66
- "nonce": "1",
67
- "address": "0xa40d5f56745a118d0906a34e69aec8c0db1cb8fa",
68
- "bytecode": "0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100855780635c60da1b146100985780638f283970146100c9578063f851a440146100e95761005d565b3661005d5761005b6100fe565b005b61005b6100fe565b34801561007157600080fd5b5061005b6100803660046106ca565b610118565b61005b6100933660046106e5565b61015f565b3480156100a457600080fd5b506100ad6101d0565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d557600080fd5b5061005b6100e43660046106ca565b61020b565b3480156100f557600080fd5b506100ad610235565b610106610292565b610116610111610331565b61033b565b565b61012061035f565b6001600160a01b0316336001600160a01b031614156101575761015481604051806020016040528060008152506000610392565b50565b6101546100fe565b61016761035f565b6001600160a01b0316336001600160a01b031614156101c8576101c38383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610392915050565b505050565b6101c36100fe565b60006101da61035f565b6001600160a01b0316336001600160a01b03161415610200576101fb610331565b905090565b6102086100fe565b90565b61021361035f565b6001600160a01b0316336001600160a01b0316141561015757610154816103f1565b600061023f61035f565b6001600160a01b0316336001600160a01b03161415610200576101fb61035f565b606061028583836040518060600160405280602781526020016107e460279139610445565b9392505050565b3b151590565b61029a61035f565b6001600160a01b0316336001600160a01b031614156101165760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b60006101fb610519565b3660008037600080366000845af43d6000803e80801561035a573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b61039b83610541565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806103dc5750805b156101c3576103eb8383610260565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61041a61035f565b604080516001600160a01b03928316815291841660208301520160405180910390a1610154816105e9565b6060833b6104a45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610328565b600080856001600160a01b0316856040516104bf9190610794565b600060405180830381855af49150503d80600081146104fa576040519150601f19603f3d011682016040523d82523d6000602084013e6104ff565b606091505b509150915061050f828286610675565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610383565b803b6105a55760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610328565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b80546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b03811661064e5760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610328565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036105c8565b60608315610684575081610285565b8251156106945782518084602001fd5b8160405162461bcd60e51b815260040161032891906107b0565b80356001600160a01b03811681146106c557600080fd5b919050565b6000602082840312156106dc57600080fd5b610285826106ae565b6000806000604084860312156106fa57600080fd5b610703846106ae565b9250602084013567ffffffffffffffff8082111561072057600080fd5b818601915086601f83011261073457600080fd5b81358181111561074357600080fd5b87602082850101111561075557600080fd5b6020830194508093505050509250925092565b60005b8381101561078357818101518382015260200161076b565b838111156103eb5750506000910152565b600082516107a6818460208701610768565b9190910192915050565b60208152600082518060208401526107cf816040850160208701610768565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212204675187caf3a43285d9a2c1844a981e977bd52a85ff073e7fc649f73847d70a464736f6c63430008090033",
69
- "storage": {
70
- "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x0000000000000000000000000f99738b2fc14d77308337f3e2596b63ae7bcc4a",
71
- "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x0000000000000000000000000200143fa295ee4dffef22ee2616c2e008d81688"
72
- }
73
- },
74
- {
75
- "contractName": "PolygonZkEVMTimelock",
76
- "balance": "0",
77
- "nonce": "1",
78
- "address": "0xBBa0935Fa93Eb23de7990b47F0D96a8f75766d13",
79
- "bytecode": "0x6080604052600436106101c65760003560e01c806364d62353116100f7578063b1c5f42711610095578063d547741f11610064578063d547741f14610661578063e38335e514610681578063f23a6e6114610694578063f27a0c92146106d957600080fd5b8063b1c5f427146105af578063bc197c81146105cf578063c4d252f514610614578063d45c44351461063457600080fd5b80638f61f4f5116100d15780638f61f4f5146104e157806391d1485414610515578063a217fddf14610566578063b08e51c01461057b57600080fd5b806364d62353146104815780638065657f146104a15780638f2a0bb0146104c157600080fd5b8063248a9ca31161016457806331d507501161013e57806331d50750146103c857806336568abe146103e85780633a6aae7214610408578063584b153e1461046157600080fd5b8063248a9ca3146103475780632ab0f529146103775780632f2ff15d146103a857600080fd5b80630d3cf6fc116101a05780630d3cf6fc1461026b578063134008d31461029f57806313bc9f20146102b2578063150b7a02146102d257600080fd5b806301d5062a146101d257806301ffc9a7146101f457806307bd02651461022957600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004611c52565b6106ee565b005b34801561020057600080fd5b5061021461020f366004611cc7565b610783565b60405190151581526020015b60405180910390f35b34801561023557600080fd5b5061025d7fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e6381565b604051908152602001610220565b34801561027757600080fd5b5061025d7f5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca581565b6101f26102ad366004611d09565b6107df565b3480156102be57600080fd5b506102146102cd366004611d75565b6108d7565b3480156102de57600080fd5b506103166102ed366004611e9a565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610220565b34801561035357600080fd5b5061025d610362366004611d75565b60009081526020819052604090206001015490565b34801561038357600080fd5b50610214610392366004611d75565b6000908152600160208190526040909120541490565b3480156103b457600080fd5b506101f26103c3366004611f02565b6108fd565b3480156103d457600080fd5b506102146103e3366004611d75565b610927565b3480156103f457600080fd5b506101f2610403366004611f02565b610940565b34801561041457600080fd5b5061043c7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610220565b34801561046d57600080fd5b5061021461047c366004611d75565b6109f8565b34801561048d57600080fd5b506101f261049c366004611d75565b610a0e565b3480156104ad57600080fd5b5061025d6104bc366004611d09565b610ade565b3480156104cd57600080fd5b506101f26104dc366004611f73565b610b1d565b3480156104ed57600080fd5b5061025d7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc181565b34801561052157600080fd5b50610214610530366004611f02565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b34801561057257600080fd5b5061025d600081565b34801561058757600080fd5b5061025d7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f78381565b3480156105bb57600080fd5b5061025d6105ca366004612025565b610d4f565b3480156105db57600080fd5b506103166105ea36600461214e565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b34801561062057600080fd5b506101f261062f366004611d75565b610d94565b34801561064057600080fd5b5061025d61064f366004611d75565b60009081526001602052604090205490565b34801561066d57600080fd5b506101f261067c366004611f02565b610e8f565b6101f261068f366004612025565b610eb4565b3480156106a057600080fd5b506103166106af3660046121f8565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b3480156106e557600080fd5b5061025d611161565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc161071881611244565b6000610728898989898989610ade565b90506107348184611251565b6000817f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8b8b8b8b8b8a604051610770969594939291906122a6565b60405180910390a3505050505050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e00000000000000000000000000000000000000000000000000000000014806107d957506107d98261139e565b92915050565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff1661085c5761085c8133611435565b600061086c888888888888610ade565b905061087881856114ed565b6108848888888861162a565b6000817fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588a8a8a8a6040516108bc94939291906122f1565b60405180910390a36108cd8161172e565b5050505050505050565b6000818152600160205260408120546001811180156108f65750428111155b9392505050565b60008281526020819052604090206001015461091881611244565b61092283836117d7565b505050565b60008181526001602052604081205481905b1192915050565b73ffffffffffffffffffffffffffffffffffffffff811633146109ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6109f482826118c7565b5050565b6000818152600160208190526040822054610939565b333014610a9d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201527f62652074696d656c6f636b00000000000000000000000000000000000000000060648201526084016109e1565b60025460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1600255565b6000868686868686604051602001610afb969594939291906122a6565b6040516020818303038152906040528051906020012090509695505050505050565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1610b4781611244565b888714610bd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b888514610c65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b6000610c778b8b8b8b8b8b8b8b610d4f565b9050610c838184611251565b60005b8a811015610d415780827f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8e8e85818110610cc357610cc3612331565b9050602002016020810190610cd89190612360565b8d8d86818110610cea57610cea612331565b905060200201358c8c87818110610d0357610d03612331565b9050602002810190610d15919061237b565b8c8b604051610d29969594939291906122a6565b60405180910390a3610d3a8161240f565b9050610c86565b505050505050505050505050565b60008888888888888888604051602001610d709897969594939291906124f7565b60405160208183030381529060405280519060200120905098975050505050505050565b7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783610dbe81611244565b610dc7826109f8565b610e53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20636160448201527f6e6e6f742062652063616e63656c6c656400000000000000000000000000000060648201526084016109e1565b6000828152600160205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b600082815260208190526040902060010154610eaa81611244565b61092283836118c7565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff16610f3157610f318133611435565b878614610fc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b87841461104f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b60006110618a8a8a8a8a8a8a8a610d4f565b905061106d81856114ed565b60005b8981101561114b5760008b8b8381811061108c5761108c612331565b90506020020160208101906110a19190612360565b905060008a8a848181106110b7576110b7612331565b9050602002013590503660008a8a868181106110d5576110d5612331565b90506020028101906110e7919061237b565b915091506110f78484848461162a565b84867fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588686868660405161112e94939291906122f1565b60405180910390a350505050806111449061240f565b9050611070565b506111558161172e565b50505050505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff161580159061123257507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166315064c966040518163ffffffff1660e01b8152600401602060405180830381865afa15801561120e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123291906125be565b1561123d5750600090565b5060025490565b61124e8133611435565b50565b61125a82610927565b156112e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201527f7265616479207363686564756c6564000000000000000000000000000000000060648201526084016109e1565b6112ef611161565b81101561137e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e7460448201527f2064656c6179000000000000000000000000000000000000000000000000000060648201526084016109e1565b61138881426125e0565b6000928352600160205260409092209190915550565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806107d957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107d9565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f4576114738161197e565b61147e83602061199d565b60405160200161148f929190612617565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526109e191600401612698565b6114f6826108d7565b611582576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b80158061159e5750600081815260016020819052604090912054145b6109f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e67206465706560448201527f6e64656e6379000000000000000000000000000000000000000000000000000060648201526084016109e1565b60008473ffffffffffffffffffffffffffffffffffffffff168484846040516116549291906126e9565b60006040518083038185875af1925050503d8060008114611691576040519150601f19603f3d011682016040523d82523d6000602084013e611696565b606091505b5050905080611727576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e67207460448201527f72616e73616374696f6e2072657665727465640000000000000000000000000060648201526084016109e1565b5050505050565b611737816108d7565b6117c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b600090815260016020819052604090912055565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556118693390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606107d973ffffffffffffffffffffffffffffffffffffffff831660145b606060006119ac8360026126f9565b6119b79060026125e0565b67ffffffffffffffff8111156119cf576119cf611d8e565b6040519080825280601f01601f1916602001820160405280156119f9576020820181803683370190505b5090507f300000000000000000000000000000000000000000000000000000000000000081600081518110611a3057611a30612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611a9357611a93612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611acf8460026126f9565b611ada9060016125e0565b90505b6001811115611b77577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611b1b57611b1b612331565b1a60f81b828281518110611b3157611b31612331565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611b7081612710565b9050611add565b5083156108f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109e1565b803573ffffffffffffffffffffffffffffffffffffffff81168114611c0457600080fd5b919050565b60008083601f840112611c1b57600080fd5b50813567ffffffffffffffff811115611c3357600080fd5b602083019150836020828501011115611c4b57600080fd5b9250929050565b600080600080600080600060c0888a031215611c6d57600080fd5b611c7688611be0565b965060208801359550604088013567ffffffffffffffff811115611c9957600080fd5b611ca58a828b01611c09565b989b979a50986060810135976080820135975060a09091013595509350505050565b600060208284031215611cd957600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146108f657600080fd5b60008060008060008060a08789031215611d2257600080fd5b611d2b87611be0565b955060208701359450604087013567ffffffffffffffff811115611d4e57600080fd5b611d5a89828a01611c09565b979a9699509760608101359660809091013595509350505050565b600060208284031215611d8757600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611e0457611e04611d8e565b604052919050565b600082601f830112611e1d57600080fd5b813567ffffffffffffffff811115611e3757611e37611d8e565b611e6860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611dbd565b818152846020838601011115611e7d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215611eb057600080fd5b611eb985611be0565b9350611ec760208601611be0565b925060408501359150606085013567ffffffffffffffff811115611eea57600080fd5b611ef687828801611e0c565b91505092959194509250565b60008060408385031215611f1557600080fd5b82359150611f2560208401611be0565b90509250929050565b60008083601f840112611f4057600080fd5b50813567ffffffffffffffff811115611f5857600080fd5b6020830191508360208260051b8501011115611c4b57600080fd5b600080600080600080600080600060c08a8c031215611f9157600080fd5b893567ffffffffffffffff80821115611fa957600080fd5b611fb58d838e01611f2e565b909b50995060208c0135915080821115611fce57600080fd5b611fda8d838e01611f2e565b909950975060408c0135915080821115611ff357600080fd5b506120008c828d01611f2e565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b60008060008060008060008060a0898b03121561204157600080fd5b883567ffffffffffffffff8082111561205957600080fd5b6120658c838d01611f2e565b909a50985060208b013591508082111561207e57600080fd5b61208a8c838d01611f2e565b909850965060408b01359150808211156120a357600080fd5b506120b08b828c01611f2e565b999c989b509699959896976060870135966080013595509350505050565b600082601f8301126120df57600080fd5b8135602067ffffffffffffffff8211156120fb576120fb611d8e565b8160051b61210a828201611dbd565b928352848101820192828101908785111561212457600080fd5b83870192505b848310156121435782358252918301919083019061212a565b979650505050505050565b600080600080600060a0868803121561216657600080fd5b61216f86611be0565b945061217d60208701611be0565b9350604086013567ffffffffffffffff8082111561219a57600080fd5b6121a689838a016120ce565b945060608801359150808211156121bc57600080fd5b6121c889838a016120ce565b935060808801359150808211156121de57600080fd5b506121eb88828901611e0c565b9150509295509295909350565b600080600080600060a0868803121561221057600080fd5b61221986611be0565b945061222760208701611be0565b93506040860135925060608601359150608086013567ffffffffffffffff81111561225157600080fd5b6121eb88828901611e0c565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff8716815285602082015260a0604082015260006122dc60a08301868861225d565b60608301949094525060800152949350505050565b73ffffffffffffffffffffffffffffffffffffffff8516815283602082015260606040820152600061232760608301848661225d565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561237257600080fd5b6108f682611be0565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126123b057600080fd5b83018035915067ffffffffffffffff8211156123cb57600080fd5b602001915036819003821315611c4b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612440576124406123e0565b5060010190565b81835260006020808501808196508560051b810191508460005b878110156124ea57828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18836030181126124a057600080fd5b8701858101903567ffffffffffffffff8111156124bc57600080fd5b8036038213156124cb57600080fd5b6124d686828461225d565b9a87019a9550505090840190600101612461565b5091979650505050505050565b60a0808252810188905260008960c08301825b8b8110156125455773ffffffffffffffffffffffffffffffffffffffff61253084611be0565b1682526020928301929091019060010161250a565b5083810360208501528881527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff89111561257e57600080fd5b8860051b9150818a602083013701828103602090810160408501526125a69082018789612447565b60608401959095525050608001529695505050505050565b6000602082840312156125d057600080fd5b815180151581146108f657600080fd5b808201808211156107d9576107d96123e0565b60005b8381101561260e5781810151838201526020016125f6565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161264f8160178501602088016125f3565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161268c8160288401602088016125f3565b01602801949350505050565b60208152600082518060208401526126b78160408501602087016125f3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b8183823760009101908152919050565b80820281158282048414176107d9576107d96123e0565b60008161271f5761271f6123e0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea26469706673582212206416c4e08f97752b4bb06159524dac058d3dccd8775e57ef1b01505751ebf7af64736f6c63430008110033",
80
- "storage": {
81
- "0x0000000000000000000000000000000000000000000000000000000000000002": "0x00000000000000000000000000000000000000000000000000000000000d2f00",
82
- "0x33d4aa03df3f12c4f615b40676f67fdafecd3edb5a9c0ca2a47a923dae33a023": "0x0000000000000000000000000000000000000000000000000000000000000001",
83
- "0x9fa2d8034dbcb437bee38d61fbd100910e1342ffc07f128aa1b8e6790b7f3f68": "0x0000000000000000000000000000000000000000000000000000000000000001",
84
- "0x64494413541ff93b31aa309254e3fed72a7456e9845988b915b4c7a7ceba8814": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5",
85
- "0x531a7c25761aa4b0f2310edca9bb25e1e3ceb49ad4b0422aec866b3ce7567c87": "0x0000000000000000000000000000000000000000000000000000000000000001",
86
- "0x3412d5605ac6cd444957cedb533e5dacad6378b4bc819ebe3652188a665066d6": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5",
87
- "0xedbedc78c4240c7613622a35de050b48bd6c6d9a31b3d485b68fbbed54a4802d": "0x0000000000000000000000000000000000000000000000000000000000000001",
88
- "0xdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d706a": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5",
89
- "0x76616448da8d124a07383c26a6b2433b3259de946aa40f51524ec96ee05e871a": "0x0000000000000000000000000000000000000000000000000000000000000001",
90
- "0xc3ad33e20b0c56a223ad5104fff154aa010f8715b9c981fd38fdc60a4d1a52fc": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5"
91
- }
92
- },
93
- {
94
- "accountName": "keyless Deployer",
95
- "balance": "0",
96
- "nonce": "1",
97
- "address": "0x9d90066e7478496e2284E54c3548106bb4F90E50"
98
- },
99
- {
100
- "accountName": "deployer",
101
- "balance": "0",
102
- "nonce": "8",
103
- "address": "0x4c1665d6651ecEfa59B9B3041951608468b18891"
104
- }
105
- ]
106
- }
107
- `
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
{/home/stefan/go/src/Polygon/zkevm-node → .}/config/network.go RENAMED
@@ -25,17 +25,16 @@
25
 
26
  type network string
27
 
28
- const mainnet network = "mainnet"
29
- const testnet network = "testnet"
30
- const cardona network = "cardona"
31
  const custom network = "custom"
32
 
33
  // GenesisFromJSON is the config file for network_custom
34
  type GenesisFromJSON struct {
35
  // L1: root hash of the genesis block
36
  Root string `json:"root"`
37
- // L1: block number of the genesis block
38
- GenesisBlockNum uint64 `json:"genesisBlockNumber"`
 
 
39
  // L2: List of states contracts used to populate merkle tree at initial state
40
  Genesis []genesisAccountFromJSON `json:"genesis"`
41
  // L1: configuration of the network
@@ -60,12 +59,6 @@
60
  func (cfg *Config) loadNetworkConfig(ctx *cli.Context) {
61
  var networkJSON string
62
  switch ctx.String(FlagNetwork) {
63
- case string(mainnet):
64
- networkJSON = MainnetNetworkConfigJSON
65
- case string(testnet):
66
- networkJSON = TestnetNetworkConfigJSON
67
- case string(cardona):
68
- networkJSON = CardonaNetworkConfigJSON
69
  case string(custom):
70
  var err error
71
  cfgPath := ctx.String(FlagCustomNetwork)
@@ -74,7 +67,7 @@
74
  panic(err.Error())
75
  }
76
  default:
77
- log.Fatalf("unsupported --network value. Must be one of: [%s, %s, %s]", mainnet, testnet, cardona, custom)
78
  }
79
  config, err := LoadGenesisFromJSONString(networkJSON)
80
  if err != nil {
@@ -122,9 +115,10 @@
122
 
123
  cfg.L1Config = cfgJSON.L1Config
124
  cfg.Genesis = state.Genesis{
125
- BlockNumber: cfgJSON.GenesisBlockNum,
126
- Root: common.HexToHash(cfgJSON.Root),
127
- Actions: []*state.GenesisAction{},
 
128
  }
129
 
130
  for _, account := range cfgJSON.Genesis {
 
25
 
26
  type network string
27
 
 
 
 
28
  const custom network = "custom"
29
 
30
  // GenesisFromJSON is the config file for network_custom
31
  type GenesisFromJSON struct {
32
  // L1: root hash of the genesis block
33
  Root string `json:"root"`
34
+ // L1: block number in which the rollup was created
35
+ RollupCreationBlockNum uint64 `json:"rollupCreationBlockNumber"`
36
+ // L1: block number in which the rollup manager was created
37
+ RollupManagerCreationBlockNum uint64 `json:"rollupManagerCreationBlockNumber"`
38
  // L2: List of states contracts used to populate merkle tree at initial state
39
  Genesis []genesisAccountFromJSON `json:"genesis"`
40
  // L1: configuration of the network
 
59
  func (cfg *Config) loadNetworkConfig(ctx *cli.Context) {
60
  var networkJSON string
61
  switch ctx.String(FlagNetwork) {
 
 
 
 
 
 
62
  case string(custom):
63
  var err error
64
  cfgPath := ctx.String(FlagCustomNetwork)
 
67
  panic(err.Error())
68
  }
69
  default:
70
+ log.Fatalf("unsupported --network value. Must be %s", custom)
71
  }
72
  config, err := LoadGenesisFromJSONString(networkJSON)
73
  if err != nil {
 
115
 
116
  cfg.L1Config = cfgJSON.L1Config
117
  cfg.Genesis = state.Genesis{
118
+ RollupBlockNumber: cfgJSON.RollupCreationBlockNum,
119
+ RollupManagerBlockNumber: cfgJSON.RollupManagerCreationBlockNum,
120
+ Root: common.HexToHash(cfgJSON.Root),
121
+ Actions: []*state.GenesisAction{},
122
  }
123
 
124
  for _, account := range cfgJSON.Genesis {
{/home/stefan/go/src/Polygon/zkevm-node → .}/config/network_test.go RENAMED
@@ -14,18 +13,6 @@
14
  "github.com/urfave/cli/v2"
15
  )
16
 
17
- func TestCardona(t *testing.T) {
18
- cfg := Config{}
19
- fs := flag.NewFlagSet("", flag.ExitOnError)
20
- fs.String(FlagNetwork, string(cardona), string(cardona))
21
- err := fs.Set(FlagNetwork, string(cardona))
22
- require.NoError(t, err)
23
- app := cli.NewApp()
24
- ctx := cli.NewContext(app, fs, nil)
25
-
26
- log.Info("flag=", ctx.String(FlagNetwork))
27
- cfg.loadNetworkConfig(ctx)
28
- }
29
  func TestLoadCustomNetworkConfig(t *testing.T) {
30
  tcs := []struct {
31
  description string
@@ -37,7 +24,8 @@
37
  description: "happy path",
38
  inputConfigStr: `{
39
  "root": "0xBEEF",
40
- "genesisBlockNumber": 69,
 
41
  "l1Config" : {
42
  "chainId": 420,
43
  "polygonZkEVMAddress": "0xc949254d682d8c9ad5682521675b8f43b102aec4",
@@ -89,8 +77,9 @@
89
  GlobalExitRootManagerAddr: common.HexToAddress("0xc949254d682d8c9ad5682521675b8f43b102aec4"),
90
  },
91
  Genesis: state.Genesis{
92
- Root: common.HexToHash("0xBEEF"),
93
- BlockNumber: 69,
 
94
  Actions: []*state.GenesisAction{
95
  {
96
  Address: "0xc949254d682d8c9ad5682521675b8f43b102aec4",
 
13
  "github.com/urfave/cli/v2"
14
  )
15
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  func TestLoadCustomNetworkConfig(t *testing.T) {
17
  tcs := []struct {
18
  description string
 
24
  description: "happy path",
25
  inputConfigStr: `{
26
  "root": "0xBEEF",
27
+ "rollupCreationBlockNumber": 69,
28
+ "rollupManagerCreationBlockNumber": 60,
29
  "l1Config" : {
30
  "chainId": 420,
31
  "polygonZkEVMAddress": "0xc949254d682d8c9ad5682521675b8f43b102aec4",
 
77
  GlobalExitRootManagerAddr: common.HexToAddress("0xc949254d682d8c9ad5682521675b8f43b102aec4"),
78
  },
79
  Genesis: state.Genesis{
80
+ Root: common.HexToHash("0xBEEF"),
81
+ RollupBlockNumber: 69,
82
+ RollupManagerBlockNumber: 60,
83
  Actions: []*state.GenesisAction{
84
  {
85
  Address: "0xc949254d682d8c9ad5682521675b8f43b102aec4",
{/home/stefan/go/src/Polygon/zkevm-node → .}/config/testnetgenesis.go RENAMED
@@ -1,108 +0,0 @@
1
- package config
2
-
3
- // TestnetNetworkConfigJSON is the hardcoded network configuration to be used for the official mainnet setup
4
- const TestnetNetworkConfigJSON = `
5
- {
6
- "l1Config" : {
7
- "chainId": 5,
8
- "polygonZkEVMAddress": "0xa997cfD539E703921fD1e3Cf25b4c241a27a4c7A",
9
- "polTokenAddress": "0x1319D23c2F7034F52Eb07399702B040bA278Ca49",
10
- "polygonZkEVMGlobalExitRootAddress": "0x4d9427DCA0406358445bC0a8F88C26b704004f74"
11
- },
12
- "root": "0x13a14c4a8288e782863d7ce916d224546c69dc428fbfa7115a0cc33a27a05b26",
13
- "genesisBlockNumber": 8572998,
14
- "genesis": [
15
- {
16
- "contractName": "PolygonZkEVMDeployer",
17
- "balance": "0",
18
- "nonce": "4",
19
- "address": "0x39877a0c3cd148476DaA2475c77c478C62eC7509",
20
- "bytecode": "0x6080604052600436106100705760003560e01c8063715018a61161004e578063715018a6146100e65780638da5cb5b146100fb578063e11ae6cb14610126578063f2fde38b1461013957600080fd5b80632b79805a146100755780634a94d4871461008a5780636d07dbf81461009d575b600080fd5b610088610083366004610927565b610159565b005b6100886100983660046109c7565b6101cb565b3480156100a957600080fd5b506100bd6100b8366004610a1e565b61020d565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b50610088610220565b34801561010757600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100bd565b610088610134366004610a40565b610234565b34801561014557600080fd5b50610088610154366004610a90565b61029b565b610161610357565b600061016e8585856103d8565b905061017a8183610537565b5060405173ffffffffffffffffffffffffffffffffffffffff821681527fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a15050505050565b6101d3610357565b6101de83838361057b565b506040517f25adb19089b6a549831a273acdf7908cff8b7ee5f551f8d1d37996cf01c5df5b90600090a1505050565b600061021983836105a9565b9392505050565b610228610357565b61023260006105b6565b565b61023c610357565b60006102498484846103d8565b60405173ffffffffffffffffffffffffffffffffffffffff821681529091507fba82f25fed02cd2a23d9f5d11c2ef588d22af5437cbf23bfe61d87257c480e4c9060200160405180910390a150505050565b6102a3610357565b73ffffffffffffffffffffffffffffffffffffffff811661034b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b610354816105b6565b50565b60005473ffffffffffffffffffffffffffffffffffffffff163314610232576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610342565b600083471015610444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e63650000006044820152606401610342565b81516000036104af576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f6044820152606401610342565b8282516020840186f5905073ffffffffffffffffffffffffffffffffffffffff8116610219576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f79000000000000006044820152606401610342565b6060610219838360006040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c6564000081525061062b565b60606105a1848484604051806060016040528060298152602001610b3d6029913961062b565b949350505050565b6000610219838330610744565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6060824710156106bd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610342565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516106e69190610acf565b60006040518083038185875af1925050503d8060008114610723576040519150601f19603f3d011682016040523d82523d6000602084013e610728565b606091505b50915091506107398783838761076e565b979650505050505050565b6000604051836040820152846020820152828152600b8101905060ff815360559020949350505050565b606083156108045782516000036107fd5773ffffffffffffffffffffffffffffffffffffffff85163b6107fd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610342565b50816105a1565b6105a183838151156108195781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103429190610aeb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600082601f83011261088d57600080fd5b813567ffffffffffffffff808211156108a8576108a861084d565b604051601f83017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156108ee576108ee61084d565b8160405283815286602085880101111561090757600080fd5b836020870160208301376000602085830101528094505050505092915050565b6000806000806080858703121561093d57600080fd5b8435935060208501359250604085013567ffffffffffffffff8082111561096357600080fd5b61096f8883890161087c565b9350606087013591508082111561098557600080fd5b506109928782880161087c565b91505092959194509250565b803573ffffffffffffffffffffffffffffffffffffffff811681146109c257600080fd5b919050565b6000806000606084860312156109dc57600080fd5b6109e58461099e565b9250602084013567ffffffffffffffff811115610a0157600080fd5b610a0d8682870161087c565b925050604084013590509250925092565b60008060408385031215610a3157600080fd5b50508035926020909101359150565b600080600060608486031215610a5557600080fd5b8335925060208401359150604084013567ffffffffffffffff811115610a7a57600080fd5b610a868682870161087c565b9150509250925092565b600060208284031215610aa257600080fd5b6102198261099e565b60005b83811015610ac6578181015183820152602001610aae565b50506000910152565b60008251610ae1818460208701610aab565b9190910192915050565b6020815260008251806020840152610b0a816040850160208701610aab565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a26469706673582212200b8e3cd6bd762444a7eeff86e1cfcd7e1ce9524b715dcb70b2a4c2b70fd5188464736f6c63430008110033",
21
- "storage": {
22
- "0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000a0b02b28920812324f1cc3255bd8840867d3f227"
23
- }
24
- },
25
- {
26
- "contractName": "ProxyAdmin",
27
- "balance": "0",
28
- "nonce": "1",
29
- "address": "0x40797c2f93298a44a893F43EdF1B33B63d7BA333",
30
- "bytecode": "0x60806040526004361061007b5760003560e01c80639623609d1161004e5780639623609d1461012b57806399a88ec41461013e578063f2fde38b1461015e578063f3b7dead1461017e57600080fd5b8063204e1c7a14610080578063715018a6146100c95780637eff275e146100e05780638da5cb5b14610100575b600080fd5b34801561008c57600080fd5b506100a061009b366004610608565b61019e565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100d557600080fd5b506100de610255565b005b3480156100ec57600080fd5b506100de6100fb36600461062c565b610269565b34801561010c57600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166100a0565b6100de610139366004610694565b6102f7565b34801561014a57600080fd5b506100de61015936600461062c565b61038c565b34801561016a57600080fd5b506100de610179366004610608565b6103e8565b34801561018a57600080fd5b506100a0610199366004610608565b6104a4565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907f5c60da1b00000000000000000000000000000000000000000000000000000000815260040190565b600060405180830381855afa9150503d8060008114610225576040519150601f19603f3d011682016040523d82523d6000602084013e61022a565b606091505b50915091508161023957600080fd5b8080602001905181019061024d9190610788565b949350505050565b61025d6104f0565b6102676000610571565b565b6102716104f0565b6040517f8f28397000000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690638f283970906024015b600060405180830381600087803b1580156102db57600080fd5b505af11580156102ef573d6000803e3d6000fd5b505050505050565b6102ff6104f0565b6040517f4f1ef28600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841690634f1ef28690349061035590869086906004016107a5565b6000604051808303818588803b15801561036e57600080fd5b505af1158015610382573d6000803e3d6000fd5b5050505050505050565b6103946104f0565b6040517f3659cfe600000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8281166004830152831690633659cfe6906024016102c1565b6103f06104f0565b73ffffffffffffffffffffffffffffffffffffffff8116610498576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b6104a181610571565b50565b60008060008373ffffffffffffffffffffffffffffffffffffffff166040516101ea907ff851a44000000000000000000000000000000000000000000000000000000000815260040190565b60005473ffffffffffffffffffffffffffffffffffffffff163314610267576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161048f565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b73ffffffffffffffffffffffffffffffffffffffff811681146104a157600080fd5b60006020828403121561061a57600080fd5b8135610625816105e6565b9392505050565b6000806040838503121561063f57600080fd5b823561064a816105e6565b9150602083013561065a816105e6565b809150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000806000606084860312156106a957600080fd5b83356106b4816105e6565b925060208401356106c4816105e6565b9150604084013567ffffffffffffffff808211156106e157600080fd5b818601915086601f8301126106f557600080fd5b81358181111561070757610707610665565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810190838211818310171561074d5761074d610665565b8160405282815289602084870101111561076657600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b60006020828403121561079a57600080fd5b8151610625816105e6565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b818110156107ef578581018301518582016060015282016107d3565b5060006060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010192505050939250505056fea2646970667358221220babd4ff1f5daee002b96cc86d8bb6c2c2c210ae3132df5ea384713352f7f15fe64736f6c63430008110033",
31
- "storage": {
32
- "0x0000000000000000000000000000000000000000000000000000000000000000": "0x00000000000000000000000002245d7b6cb0b6870d1e28ac877ee355b9588869"
33
- }
34
- },
35
- {
36
- "contractName": "PolygonZkEVMBridge implementation",
37
- "balance": "0",
38
- "nonce": "1",
39
- "address": "0x39e780D8800f7396e8B7530A8925B14025AedC77",
40
- "bytecode": "0x6080604052600436106200019f5760003560e01c8063647c576c11620000e7578063be5831c71162000089578063dbc169761162000060578063dbc169761462000639578063ee25560b1462000651578063fb570834146200068257600080fd5b8063be5831c714620005ae578063cd58657914620005ea578063d02103ca146200060157600080fd5b80639e34070f11620000be5780639e34070f146200050a578063aaa13cc2146200054f578063bab161bf146200057457600080fd5b8063647c576c146200048657806379e2cf9714620004ab57806381b1c17414620004c357600080fd5b80632d2c9d94116200015157806334ac9cf2116200012857806334ac9cf2146200034b5780633ae05047146200037a5780633e197043146200039257600080fd5b80632d2c9d9414620002765780632dfdf0b5146200029b578063318aee3d14620002c257600080fd5b806322e95f2c116200018657806322e95f2c14620001ef578063240ff378146200023a5780632cffd02e146200025157600080fd5b806315064c9614620001a45780632072f6c514620001d5575b600080fd5b348015620001b157600080fd5b50606854620001c09060ff1681565b60405190151581526020015b60405180910390f35b348015620001e257600080fd5b50620001ed620006a7565b005b348015620001fc57600080fd5b50620002146200020e366004620032db565b62000705565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001620001cc565b620001ed6200024b36600462003372565b620007a8565b3480156200025e57600080fd5b50620001ed6200027036600462003409565b620009d0565b3480156200028357600080fd5b50620001ed6200029536600462003409565b62000f74565b348015620002a857600080fd5b50620002b360535481565b604051908152602001620001cc565b348015620002cf57600080fd5b5062000319620002e1366004620034ef565b606b6020526000908152604090205463ffffffff811690640100000000900473ffffffffffffffffffffffffffffffffffffffff1682565b6040805163ffffffff909316835273ffffffffffffffffffffffffffffffffffffffff909116602083015201620001cc565b3480156200035857600080fd5b50606c54620002149073ffffffffffffffffffffffffffffffffffffffff1681565b3480156200038757600080fd5b50620002b362001178565b3480156200039f57600080fd5b50620002b3620003b136600462003526565b6040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b3480156200049357600080fd5b50620001ed620004a5366004620035b0565b6200125e565b348015620004b857600080fd5b50620001ed620014ad565b348015620004d057600080fd5b5062000214620004e236600462003600565b606a6020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200051757600080fd5b50620001c06200052936600462003600565b600881901c600090815260696020526040902054600160ff9092169190911b9081161490565b3480156200055c57600080fd5b50620002146200056e3660046200361a565b620014e7565b3480156200058157600080fd5b506068546200059890610100900463ffffffff1681565b60405163ffffffff9091168152602001620001cc565b348015620005bb57600080fd5b506068546200059890790100000000000000000000000000000000000000000000000000900463ffffffff1681565b620001ed620005fb366004620036ce565b620016d3565b3480156200060e57600080fd5b50606854620002149065010000000000900473ffffffffffffffffffffffffffffffffffffffff1681565b3480156200064657600080fd5b50620001ed62001c37565b3480156200065e57600080fd5b50620002b36200067036600462003600565b60696020526000908152604090205481565b3480156200068f57600080fd5b50620001c0620006a136600462003770565b62001c93565b606c5473ffffffffffffffffffffffffffffffffffffffff163314620006f9576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362001d7c565b565b6040805160e084901b7fffffffff0000000000000000000000000000000000000000000000000000000016602080830191909152606084901b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000016602483015282516018818403018152603890920183528151918101919091206000908152606a909152205473ffffffffffffffffffffffffffffffffffffffff165b92915050565b60685460ff1615620007e6576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff8681166101009092041614806200080c5750600263ffffffff861610155b1562000844576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b6001606860019054906101000a900463ffffffff163388883488886053546040516200089a9998979695949392919062003806565b60405180910390a1620009b8620009b26001606860019054906101000a900463ffffffff16338989348989604051620008d592919062003881565b60405180910390206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b62001e10565b8215620009c957620009c962001f27565b5050505050565b60685460ff161562000a0e576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000a258b8b8b8b8b8b8b8b8b8b8b600062001ffc565b73ffffffffffffffffffffffffffffffffffffffff861662000b01576040805160008082526020820190925273ffffffffffffffffffffffffffffffffffffffff861690859060405162000a7a9190620038e6565b60006040518083038185875af1925050503d806000811462000ab9576040519150601f19603f3d011682016040523d82523d6000602084013e62000abe565b606091505b505090508062000afa576040517f6747a28800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5062000efc565b60685463ffffffff61010090910481169088160362000b435762000b3d73ffffffffffffffffffffffffffffffffffffffff87168585620021ed565b62000efc565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b166024820152600090603801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291815281516020928301206000818152606a90935291205490915073ffffffffffffffffffffffffffffffffffffffff168062000e6e576000808062000c1886880188620039fb565b92509250925060008584848460405162000c329062003292565b62000c409392919062003abd565b8190604051809103906000f590508015801562000c61573d6000803e3d6000fd5b506040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8c81166004830152602482018c9052919250908216906340c10f1990604401600060405180830381600087803b15801562000cd757600080fd5b505af115801562000cec573d6000803e3d6000fd5b5050505080606a600088815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060405180604001604052808e63ffffffff1681526020018d73ffffffffffffffffffffffffffffffffffffffff16815250606b60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008201518160000160006101000a81548163ffffffff021916908363ffffffff16021790555060208201518160000160046101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055509050507f490e59a1701b938786ac72570a1efeac994a3dbe96e2e883e19e902ace6e6a398d8d838b8b60405162000e5c95949392919062003afa565b60405180910390a15050505062000ef9565b6040517f40c10f1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8781166004830152602482018790528216906340c10f1990604401600060405180830381600087803b15801562000edf57600080fd5b505af115801562000ef4573d6000803e3d6000fd5b505050505b50505b6040805163ffffffff8c811682528916602082015273ffffffffffffffffffffffffffffffffffffffff88811682840152861660608201526080810185905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a15050505050505050505050565b60685460ff161562000fb2576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62000fc98b8b8b8b8b8b8b8b8b8b8b600162001ffc565b60008473ffffffffffffffffffffffffffffffffffffffff1684888a868660405160240162000ffc949392919062003b42565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529181526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f1806b5f200000000000000000000000000000000000000000000000000000000179052516200107f9190620038e6565b60006040518083038185875af1925050503d8060008114620010be576040519150601f19603f3d011682016040523d82523d6000602084013e620010c3565b606091505b5050905080620010ff576040517f37e391c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805163ffffffff8d811682528a16602082015273ffffffffffffffffffffffffffffffffffffffff89811682840152871660608201526080810186905290517f25308c93ceeed162da955b3f7ce3e3f93606579e40fb92029faa9efe275459839181900360a00190a1505050505050505050505050565b605354600090819081805b602081101562001255578083901c600116600103620011e65760338160208110620011b257620011b262003b8a565b0154604080516020810192909252810185905260600160405160208183030381529060405280519060200120935062001213565b60408051602081018690529081018390526060016040516020818303038152906040528051906020012093505b604080516020810184905290810183905260600160405160208183030381529060405280519060200120915080806200124c9062003be8565b91505062001183565b50919392505050565b600054610100900460ff16158080156200127f5750600054600160ff909116105b806200129b5750303b1580156200129b575060005460ff166001145b6200132d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156200138c57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b606880547fffffffffffffff000000000000000000000000000000000000000000000000ff1661010063ffffffff8716027fffffffffffffff0000000000000000000000000000000000000000ffffffffff16176501000000000073ffffffffffffffffffffffffffffffffffffffff8681169190910291909117909155606c80547fffffffffffffffffffffffff00000000000000000000000000000000000000001691841691909117905562001443620022c3565b8015620014a757600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b605354606854790100000000000000000000000000000000000000000000000000900463ffffffff16101562000703576200070362001f27565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e089901b1660208201527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606088901b1660248201526000908190603801604051602081830303815290604052805190602001209050600060ff60f81b3083604051806020016200157d9062003292565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe082820381018352601f909101166040819052620015c8908d908d908d908d908d9060200162003c23565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905262001606929160200162003c64565b604051602081830303815290604052805190602001206040516020016200168f94939291907fff0000000000000000000000000000000000000000000000000000000000000094909416845260609290921b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660018401526015830152603582015260550190565b604080518083037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe001815291905280516020909101209a9950505050505050505050565b60685460ff161562001711576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200171b62002366565b60685463ffffffff888116610100909204161480620017415750600263ffffffff881610155b1562001779576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008060608773ffffffffffffffffffffffffffffffffffffffff8816620017df57883414620017d5576040517fb89240f500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000925062001ad9565b341562001818576040517f798ee6f100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8089166000908152606b602090815260409182902082518084019093525463ffffffff811683526401000000009004909216918101829052901562001908576040517f9dc29fac000000000000000000000000000000000000000000000000000000008152336004820152602481018b905273ffffffffffffffffffffffffffffffffffffffff8a1690639dc29fac90604401600060405180830381600087803b158015620018db57600080fd5b505af1158015620018f0573d6000803e3d6000fd5b50505050806020015194508060000151935062001ad7565b85156200191d576200191d898b8989620023db565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8b16906370a0823190602401602060405180830381865afa1580156200198b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620019b1919062003c97565b9050620019d773ffffffffffffffffffffffffffffffffffffffff8b1633308e620028f9565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa15801562001a45573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001a6b919062003c97565b905062001a79828262003cb1565b6068548c9850610100900463ffffffff169650935062001a998762002959565b62001aa48c62002a71565b62001aaf8d62002b7e565b60405160200162001ac39392919062003abd565b604051602081830303815290604052945050505b505b7f501781209a1f8899323b96b4ef08b168df93e0a90c673d1e4cce39366cb62f9b600084868e8e868860535460405162001b1b98979695949392919062003cc7565b60405180910390a162001c0f620009b2600085878f8f8789805190602001206040517fff0000000000000000000000000000000000000000000000000000000000000060f889901b1660208201527fffffffff0000000000000000000000000000000000000000000000000000000060e088811b821660218401527fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606089811b821660258601529188901b909216603984015285901b16603d8201526051810183905260718101829052600090609101604051602081830303815290604052805190602001209050979650505050505050565b861562001c205762001c2062001f27565b5050505062001c2e60018055565b50505050505050565b606c5473ffffffffffffffffffffffffffffffffffffffff16331462001c89576040517fe2e8106b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6200070362002c80565b600084815b602081101562001d6e57600163ffffffff8616821c8116900362001d0a5785816020811062001ccb5762001ccb62003b8a565b60200201358260405160200162001cec929190918252602082015260400190565b60405160208183030381529060405280519060200120915062001d59565b8186826020811062001d205762001d2062003b8a565b602002013560405160200162001d40929190918252602082015260400190565b6040516020818303038152906040528051906020012091505b8062001d658162003be8565b91505062001c98565b50821490505b949350505050565b60685460ff161562001dba576040517f2f0047fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556040517f2261efe5aef6fedc1fd1550b25facc9181745623049c7901287030b9ad1a549790600090a1565b80600162001e216020600262003e79565b62001e2d919062003cb1565b6053541062001e68576040517fef5ccf6600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600060536000815462001e7b9062003be8565b9182905550905060005b602081101562001f17578082901c60011660010362001ebd57826033826020811062001eb55762001eb562003b8a565b015550505050565b6033816020811062001ed35762001ed362003b8a565b01546040805160208101929092528101849052606001604051602081830303815290604052805190602001209250808062001f0e9062003be8565b91505062001e85565b5062001f2262003e87565b505050565b6053546068805463ffffffff909216790100000000000000000000000000000000000000000000000000027fffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffffff909216919091179081905573ffffffffffffffffffffffffffffffffffffffff65010000000000909104166333d6247d62001fad62001178565b6040518263ffffffff1660e01b815260040162001fcc91815260200190565b600060405180830381600087803b15801562001fe757600080fd5b505af1158015620014a7573d6000803e3d6000fd5b6200200d8b63ffffffff1662002d10565b6068546040805160208082018e90528183018d9052825180830384018152606083019384905280519101207f257b363200000000000000000000000000000000000000000000000000000000909252606481019190915260009165010000000000900473ffffffffffffffffffffffffffffffffffffffff169063257b3632906084016020604051808303816000875af1158015620020b0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620020d6919062003c97565b90508060000362002112576040517e2f6fad00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60685463ffffffff88811661010090920416146200215c576040517f0595ea2e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606854600090610100900463ffffffff166200217a5750896200217d565b508a5b620021a66200219d848c8c8c8c8c8c8c604051620008d592919062003881565b8f8f8462001c93565b620021dd576040517fe0417cec00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905262001f229084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915262002d75565b600054610100900460ff166200235c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6200070362002e88565b600260015403620023d4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640162001324565b6002600155565b6000620023ec600482848662003eb6565b620023f79162003ee2565b90507f2afa5331000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000821601620026765760008080808080806200245a896004818d62003eb6565b81019062002469919062003f2b565b96509650965096509650965096503373ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff1614620024dd576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff861630146200252d576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8a851462002567576040517f03fffc4b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff89811660248301528881166044830152606482018890526084820187905260ff861660a483015260c4820185905260e48083018590528351808403909101815261010490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fd505accf000000000000000000000000000000000000000000000000000000001790529151918e1691620026229190620038e6565b6000604051808303816000865af19150503d806000811462002661576040519150601f19603f3d011682016040523d82523d6000602084013e62002666565b606091505b50505050505050505050620009c9565b7fffffffff0000000000000000000000000000000000000000000000000000000081167f8fcbaf0c0000000000000000000000000000000000000000000000000000000014620026f2576040517fe282c0ba00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808080808080806200270a8a6004818e62003eb6565b81019062002719919062003f86565b975097509750975097509750975097503373ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff16146200278f576040517f912ecce700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff87163014620027df576040517f750643af00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040805173ffffffffffffffffffffffffffffffffffffffff8a811660248301528981166044830152606482018990526084820188905286151560a483015260ff861660c483015260e482018590526101048083018590528351808403909101815261012490920183526020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f8fcbaf0c000000000000000000000000000000000000000000000000000000001790529151918f1691620028a39190620038e6565b6000604051808303816000865af19150503d8060008114620028e2576040519150601f19603f3d011682016040523d82523d6000602084013e620028e7565b606091505b50505050505050505050505050505050565b60405173ffffffffffffffffffffffffffffffffffffffff80851660248301528316604482015260648101829052620014a79085907f23b872dd000000000000000000000000000000000000000000000000000000009060840162002240565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f06fdde03000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff861691620029dd9190620038e6565b600060405180830381855afa9150503d806000811462002a1a576040519150601f19603f3d011682016040523d82523d6000602084013e62002a1f565b606091505b50915091508162002a66576040518060400160405280600781526020017f4e4f5f4e414d450000000000000000000000000000000000000000000000000081525062001d74565b62001d748162002f21565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f95d89b41000000000000000000000000000000000000000000000000000000001790529051606091600091829173ffffffffffffffffffffffffffffffffffffffff86169162002af59190620038e6565b600060405180830381855afa9150503d806000811462002b32576040519150601f19603f3d011682016040523d82523d6000602084013e62002b37565b606091505b50915091508162002a66576040518060400160405280600981526020017f4e4f5f53594d424f4c000000000000000000000000000000000000000000000081525062001d74565b60408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f313ce5670000000000000000000000000000000000000000000000000000000017905290516000918291829173ffffffffffffffffffffffffffffffffffffffff86169162002c019190620038e6565b600060405180830381855afa9150503d806000811462002c3e576040519150601f19603f3d011682016040523d82523d6000602084013e62002c43565b606091505b509150915081801562002c57575080516020145b62002c6457601262001d74565b8080602001905181019062001d74919062004012565b60018055565b60685460ff1662002cbd576040517f5386698100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606880547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690556040517f1e5e34eea33501aecf2ebec9fe0e884a40804275ea7fe10b2ba084c8374308b390600090a1565b600881901c60008181526069602052604081208054600160ff861690811b91821892839055929091908183169003620009c9576040517f646cf55800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600062002dd9826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16620031119092919063ffffffff16565b80519091501562001f22578080602001905181019062002dfa919062004032565b62001f22576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840162001324565b600054610100900460ff1662002c7a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e67000000000000000000000000000000000000000000606482015260840162001324565b6060604082511062002f435781806020019051810190620007a2919062004052565b8151602003620030d35760005b60208110801562002f9b575082818151811062002f715762002f7162003b8a565b01602001517fff000000000000000000000000000000000000000000000000000000000000001615155b1562002fb6578062002fad8162003be8565b91505062002f50565b8060000362002ffa57505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e4700000000000000000000000000006020820152919050565b60008167ffffffffffffffff81111562003018576200301862003891565b6040519080825280601f01601f19166020018201604052801562003043576020820181803683370190505b50905060005b82811015620030cb5784818151811062003067576200306762003b8a565b602001015160f81c60f81b82828151811062003087576200308762003b8a565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080620030c28162003be8565b91505062003049565b509392505050565b505060408051808201909152601281527f4e4f545f56414c49445f454e434f44494e470000000000000000000000000000602082015290565b919050565b606062001d748484600085856000808673ffffffffffffffffffffffffffffffffffffffff168587604051620031489190620038e6565b60006040518083038185875af1925050503d806000811462003187576040519150601f19603f3d011682016040523d82523d6000602084013e6200318c565b606091505b50915091506200319f87838387620031aa565b979650505050505050565b60608315620032455782516000036200323d5773ffffffffffffffffffffffffffffffffffffffff85163b6200323d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640162001324565b508162001d74565b62001d7483838151156200325c5781518083602001fd5b806040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620013249190620040d2565b611b6680620040e883390190565b803563ffffffff811681146200310c57600080fd5b73ffffffffffffffffffffffffffffffffffffffff81168114620032d857600080fd5b50565b60008060408385031215620032ef57600080fd5b620032fa83620032a0565b915060208301356200330c81620032b5565b809150509250929050565b8015158114620032d857600080fd5b60008083601f8401126200333957600080fd5b50813567ffffffffffffffff8111156200335257600080fd5b6020830191508360208285010111156200336b57600080fd5b9250929050565b6000806000806000608086880312156200338b57600080fd5b6200339686620032a0565b94506020860135620033a881620032b5565b93506040860135620033ba8162003317565b9250606086013567ffffffffffffffff811115620033d757600080fd5b620033e58882890162003326565b969995985093965092949392505050565b806104008101831015620007a257600080fd5b60008060008060008060008060008060006105208c8e0312156200342c57600080fd5b620034388d8d620033f6565b9a50620034496104008d01620032a0565b99506104208c013598506104408c013597506200346a6104608d01620032a0565b96506104808c01356200347d81620032b5565b95506200348e6104a08d01620032a0565b94506104c08c0135620034a181620032b5565b93506104e08c013592506105008c013567ffffffffffffffff811115620034c757600080fd5b620034d58e828f0162003326565b915080935050809150509295989b509295989b9093969950565b6000602082840312156200350257600080fd5b81356200350f81620032b5565b9392505050565b60ff81168114620032d857600080fd5b600080600080600080600060e0888a0312156200354257600080fd5b87356200354f8162003516565b96506200355f60208901620032a0565b955060408801356200357181620032b5565b94506200358160608901620032a0565b935060808801356200359381620032b5565b9699959850939692959460a0840135945060c09093013592915050565b600080600060608486031215620035c657600080fd5b620035d184620032a0565b92506020840135620035e381620032b5565b91506040840135620035f581620032b5565b809150509250925092565b6000602082840312156200361357600080fd5b5035919050565b600080600080600080600060a0888a0312156200363657600080fd5b6200364188620032a0565b965060208801356200365381620032b5565b9550604088013567ffffffffffffffff808211156200367157600080fd5b6200367f8b838c0162003326565b909750955060608a01359150808211156200369957600080fd5b50620036a88a828b0162003326565b9094509250506080880135620036be8162003516565b8091505092959891949750929550565b600080600080600080600060c0888a031215620036ea57600080fd5b620036f588620032a0565b965060208801356200370781620032b5565b95506040880135945060608801356200372081620032b5565b93506080880135620037328162003317565b925060a088013567ffffffffffffffff8111156200374f57600080fd5b6200375d8a828b0162003326565b989b979a50959850939692959293505050565b60008060008061046085870312156200378857600080fd5b843593506200379b8660208701620033f6565b9250620037ac6104208601620032a0565b939692955092936104400135925050565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b600061010060ff8c16835263ffffffff808c16602085015273ffffffffffffffffffffffffffffffffffffffff808c166040860152818b166060860152808a166080860152508760a08501528160c0850152620038678285018789620037bd565b925080851660e085015250509a9950505050505050505050565b8183823760009101908152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60005b83811015620038dd578181015183820152602001620038c3565b50506000910152565b60008251620038fa818460208701620038c0565b9190910192915050565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156200394e576200394e62003891565b604052919050565b600067ffffffffffffffff82111562003973576200397362003891565b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01660200190565b600082601f830112620039b157600080fd5b8135620039c8620039c28262003956565b62003904565b818152846020838601011115620039de57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121562003a1157600080fd5b833567ffffffffffffffff8082111562003a2a57600080fd5b62003a38878388016200399f565b9450602086013591508082111562003a4f57600080fd5b5062003a5e868287016200399f565b9250506040840135620035f58162003516565b6000815180845262003a8b816020860160208601620038c0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60608152600062003ad2606083018662003a71565b828103602084015262003ae6818662003a71565b91505060ff83166040830152949350505050565b63ffffffff86168152600073ffffffffffffffffffffffffffffffffffffffff8087166020840152808616604084015250608060608301526200319f608083018486620037bd565b73ffffffffffffffffffffffffffffffffffffffff8516815263ffffffff8416602082015260606040820152600062003b80606083018486620037bd565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820362003c1c5762003c1c62003bb9565b5060010190565b60608152600062003c39606083018789620037bd565b828103602084015262003c4e818688620037bd565b91505060ff831660408301529695505050505050565b6000835162003c78818460208801620038c0565b83519083019062003c8e818360208801620038c0565b01949350505050565b60006020828403121562003caa57600080fd5b5051919050565b81810381811115620007a257620007a262003bb9565b600061010060ff8b16835263ffffffff808b16602085015273ffffffffffffffffffffffffffffffffffffffff808b166040860152818a1660608601528089166080860152508660a08501528160c085015262003d278285018762003a71565b925080851660e085015250509998505050505050505050565b600181815b8085111562003d9f57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003d835762003d8362003bb9565b8085161562003d9157918102915b93841c939080029062003d45565b509250929050565b60008262003db857506001620007a2565b8162003dc757506000620007a2565b816001811462003de0576002811462003deb5762003e0b565b6001915050620007a2565b60ff84111562003dff5762003dff62003bb9565b50506001821b620007a2565b5060208310610133831016604e8410600b841016171562003e30575081810a620007a2565b62003e3c838362003d40565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111562003e715762003e7162003bb9565b029392505050565b60006200350f838362003da7565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052600160045260246000fd5b6000808585111562003ec757600080fd5b8386111562003ed557600080fd5b5050820193919092039150565b7fffffffff00000000000000000000000000000000000000000000000000000000813581811691600485101562003f235780818660040360031b1b83161692505b505092915050565b600080600080600080600060e0888a03121562003f4757600080fd5b873562003f5481620032b5565b9650602088013562003f6681620032b5565b955060408801359450606088013593506080880135620035938162003516565b600080600080600080600080610100898b03121562003fa457600080fd5b883562003fb181620032b5565b9750602089013562003fc381620032b5565b96506040890135955060608901359450608089013562003fe38162003317565b935060a089013562003ff58162003516565b979a969950949793969295929450505060c08201359160e0013590565b6000602082840312156200402557600080fd5b81516200350f8162003516565b6000602082840312156200404557600080fd5b81516200350f8162003317565b6000602082840312156200406557600080fd5b815167ffffffffffffffff8111156200407d57600080fd5b8201601f810184136200408f57600080fd5b8051620040a0620039c28262003956565b818152856020838501011115620040b657600080fd5b620040c9826020830160208601620038c0565b95945050505050565b6020815260006200350f602083018462003a7156fe6101006040523480156200001257600080fd5b5060405162001b6638038062001b6683398101604081905262000035916200028d565b82826003620000458382620003a1565b506004620000548282620003a1565b50503360c0525060ff811660e052466080819052620000739062000080565b60a052506200046d915050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620000ad6200012e565b805160209182012060408051808201825260018152603160f81b90840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b6060600380546200013f9062000312565b80601f01602080910402602001604051908101604052809291908181526020018280546200016d9062000312565b8015620001be5780601f106200019257610100808354040283529160200191620001be565b820191906000526020600020905b815481529060010190602001808311620001a057829003601f168201915b5050505050905090565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620001f057600080fd5b81516001600160401b03808211156200020d576200020d620001c8565b604051601f8301601f19908116603f01168101908282118183101715620002385762000238620001c8565b816040528381526020925086838588010111156200025557600080fd5b600091505b838210156200027957858201830151818301840152908201906200025a565b600093810190920192909252949350505050565b600080600060608486031215620002a357600080fd5b83516001600160401b0380821115620002bb57600080fd5b620002c987838801620001de565b94506020860151915080821115620002e057600080fd5b50620002ef86828701620001de565b925050604084015160ff811681146200030757600080fd5b809150509250925092565b600181811c908216806200032757607f821691505b6020821081036200034857634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200039c57600081815260208120601f850160051c81016020861015620003775750805b601f850160051c820191505b81811015620003985782815560010162000383565b5050505b505050565b81516001600160401b03811115620003bd57620003bd620001c8565b620003d581620003ce845462000312565b846200034e565b602080601f8311600181146200040d5760008415620003f45750858301515b600019600386901b1c1916600185901b17855562000398565b600085815260208120601f198616915b828110156200043e578886015182559484019460019091019084016200041d565b50858210156200045d5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e0516116aa620004bc6000396000610237015260008181610307015281816105c001526106a70152600061053a015260008181610379015261050401526116aa6000f3fe608060405234801561001057600080fd5b50600436106101775760003560e01c806370a08231116100d8578063a457c2d71161008c578063d505accf11610066578063d505accf1461039b578063dd62ed3e146103ae578063ffa1ad74146103f457600080fd5b8063a457c2d71461034e578063a9059cbb14610361578063cd0d00961461037457600080fd5b806395d89b41116100bd57806395d89b41146102e75780639dc29fac146102ef578063a3c573eb1461030257600080fd5b806370a08231146102915780637ecebe00146102c757600080fd5b806330adf81f1161012f5780633644e515116101145780633644e51514610261578063395093511461026957806340c10f191461027c57600080fd5b806330adf81f14610209578063313ce5671461023057600080fd5b806318160ddd1161016057806318160ddd146101bd57806320606b70146101cf57806323b872dd146101f657600080fd5b806306fdde031461017c578063095ea7b31461019a575b600080fd5b610184610430565b60405161019191906113e4565b60405180910390f35b6101ad6101a8366004611479565b6104c2565b6040519015158152602001610191565b6002545b604051908152602001610191565b6101c17f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b6101ad6102043660046114a3565b6104dc565b6101c17f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b60405160ff7f0000000000000000000000000000000000000000000000000000000000000000168152602001610191565b6101c1610500565b6101ad610277366004611479565b61055c565b61028f61028a366004611479565b6105a8565b005b6101c161029f3660046114df565b73ffffffffffffffffffffffffffffffffffffffff1660009081526020819052604090205490565b6101c16102d53660046114df565b60056020526000908152604090205481565b610184610680565b61028f6102fd366004611479565b61068f565b6103297f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610191565b6101ad61035c366004611479565b61075e565b6101ad61036f366004611479565b61082f565b6101c17f000000000000000000000000000000000000000000000000000000000000000081565b61028f6103a9366004611501565b61083d565b6101c16103bc366004611574565b73ffffffffffffffffffffffffffffffffffffffff918216600090815260016020908152604080832093909416825291909152205490565b6101846040518060400160405280600181526020017f310000000000000000000000000000000000000000000000000000000000000081525081565b60606003805461043f906115a7565b80601f016020809104026020016040519081016040528092919081815260200182805461046b906115a7565b80156104b85780601f1061048d576101008083540402835291602001916104b8565b820191906000526020600020905b81548152906001019060200180831161049b57829003601f168201915b5050505050905090565b6000336104d0818585610b73565b60019150505b92915050565b6000336104ea858285610d27565b6104f5858585610dfe565b506001949350505050565b60007f00000000000000000000000000000000000000000000000000000000000000004614610537576105324661106d565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff871684529091528120549091906104d090829086906105a3908790611629565b610b73565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610672576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d4272696467650000000000000000000000000000000060648201526084015b60405180910390fd5b61067c8282611135565b5050565b60606004805461043f906115a7565b3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610754576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f546f6b656e577261707065643a3a6f6e6c794272696467653a204e6f7420506f60448201527f6c79676f6e5a6b45564d427269646765000000000000000000000000000000006064820152608401610669565b61067c8282611228565b33600081815260016020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716845290915281205490919083811015610822576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610669565b6104f58286868403610b73565b6000336104d0818585610dfe565b834211156108cc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f546f6b656e577261707065643a3a7065726d69743a204578706972656420706560448201527f726d6974000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8716600090815260056020526040812080547f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918a918a918a9190866109268361163c565b9091555060408051602081019690965273ffffffffffffffffffffffffffffffffffffffff94851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090506000610991610500565b6040517f19010000000000000000000000000000000000000000000000000000000000006020820152602281019190915260428101839052606201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600080855291840180845281905260ff89169284019290925260608301879052608083018690529092509060019060a0016020604051602081039080840390855afa158015610a55573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590610ad057508973ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b610b5c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f546f6b656e577261707065643a3a7065726d69743a20496e76616c696420736960448201527f676e6174757265000000000000000000000000000000000000000000000000006064820152608401610669565b610b678a8a8a610b73565b50505050505050505050565b73ffffffffffffffffffffffffffffffffffffffff8316610c15576040517f08c379a0000000000000000000000000000000000000000000000000000000008152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610cb8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b73ffffffffffffffffffffffffffffffffffffffff8381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114610df85781811015610deb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610669565b610df88484848403610b73565b50505050565b73ffffffffffffffffffffffffffffffffffffffff8316610ea1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff8216610f44576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff831660009081526020819052604090205481811015610ffa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3610df8565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f611098610430565b8051602091820120604080518082018252600181527f310000000000000000000000000000000000000000000000000000000000000090840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018390523060a082015260c001604051602081830303815290604052805190602001209050919050565b73ffffffffffffffffffffffffffffffffffffffff82166111b2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610669565b80600260008282546111c49190611629565b909155505073ffffffffffffffffffffffffffffffffffffffff8216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b73ffffffffffffffffffffffffffffffffffffffff82166112cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f73000000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff821660009081526020819052604090205481811015611381576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f63650000000000000000000000000000000000000000000000000000000000006064820152608401610669565b73ffffffffffffffffffffffffffffffffffffffff83166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101610d1a565b600060208083528351808285015260005b81811015611411578581018301518582016040015282016113f5565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461147457600080fd5b919050565b6000806040838503121561148c57600080fd5b61149583611450565b946020939093013593505050565b6000806000606084860312156114b857600080fd5b6114c184611450565b92506114cf60208501611450565b9150604084013590509250925092565b6000602082840312156114f157600080fd5b6114fa82611450565b9392505050565b600080600080600080600060e0888a03121561151c57600080fd5b61152588611450565b965061153360208901611450565b95506040880135945060608801359350608088013560ff8116811461155757600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561158757600080fd5b61159083611450565b915061159e60208401611450565b90509250929050565b600181811c908216806115bb57607f821691505b6020821081036115f4577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808201808211156104d6576104d66115fa565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361166d5761166d6115fa565b506001019056fea26469706673582212208d88fee561cff7120d381c345cfc534cef8229a272dc5809d4bbb685ad67141164736f6c63430008110033a2646970667358221220addfd62f466d34ee002afbb4ae37b6be56ad421fe773f800badeb4ce1025089864736f6c63430008110033"
41
- },
42
- {
43
- "contractName": "PolygonZkEVMBridge proxy",
44
- "balance": "200000000000000000000000000",
45
- "nonce": "1",
46
- "address": "0xF6BEEeBB578e214CA9E23B0e9683454Ff88Ed2A7",
47
- "bytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b61009036600461088b565b610135565b61006b6100a33660046108a6565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b61010136600461088b565b610231565b34801561011257600080fd5b506100bd61025e565b6101236102d4565b61013361012e6103ab565b6103b5565b565b61013d6103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481604051806020016040528060008152506000610419565b50565b61017461011b565b6101876103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610419915050565b505050565b6101e661011b565b60006101fd6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103ab565b905090565b61022e61011b565b90565b6102396103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481610444565b60006102686103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103d9565b60606102b183836040518060600160405280602781526020016109bb602791396104a5565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6102dc6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b600061022161052a565b3660008037600080366000845af43d6000803e8080156103d4573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b61042283610552565b60008251118061042f5750805b156101e65761043e838361028c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61046d6103d9565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a16101748161059f565b60606000808573ffffffffffffffffffffffffffffffffffffffff16856040516104cf919061094d565b600060405180830381855af49150503d806000811461050a576040519150601f19603f3d011682016040523d82523d6000602084013e61050f565b606091505b5091509150610520868383876106ab565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103fd565b61055b81610753565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff8116610642576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103a2565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b6060831561074157825160000361073a5773ffffffffffffffffffffffffffffffffffffffff85163b61073a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016103a2565b508161074b565b61074b838361081e565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff81163b6107f7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016103a2565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610665565b81511561082e5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a29190610969565b803573ffffffffffffffffffffffffffffffffffffffff8116811461088657600080fd5b919050565b60006020828403121561089d57600080fd5b6102b182610862565b6000806000604084860312156108bb57600080fd5b6108c484610862565b9250602084013567ffffffffffffffff808211156108e157600080fd5b818601915086601f8301126108f557600080fd5b81358181111561090457600080fd5b87602082850101111561091657600080fd5b6020830194508093505050509250925092565b60005b8381101561094457818101518382015260200161092c565b50506000910152565b6000825161095f818460208701610929565b9190910192915050565b6020815260008251806020840152610988816040850160208701610929565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220a1af0d6cb4f1e31496a4c5c1448913bce4bd6ad3a39e47c6f7190c114d6f9bf464736f6c63430008110033",
48
- "storage": {
49
- "0x0000000000000000000000000000000000000000000000000000000000000000": "0x0000000000000000000000000000000000000000000000000000000000000001",
50
- "0x0000000000000000000000000000000000000000000000000000000000000001": "0x0000000000000000000000000000000000000000000000000000000000000001",
51
- "0x0000000000000000000000000000000000000000000000000000000000000068": "0x00000000000000a40d5f56745a118d0906a34e69aec8c0db1cb8fa0000000100",
52
- "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x00000000000000000000000040797c2f93298a44a893f43edf1b33b63d7ba333",
53
- "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x00000000000000000000000039e780d8800f7396e8b7530a8925b14025aedc77"
54
- }
55
- },
56
- {
57
- "contractName": "PolygonZkEVMGlobalExitRootL2 implementation",
58
- "balance": "0",
59
- "nonce": "1",
60
- "address": "0x77Fc57b154fCF8320Df2C2e6C044AA50141c023b",
61
- "bytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806301fd904414610051578063257b36321461006d57806333d6247d1461008d578063a3c573eb146100a2575b600080fd5b61005a60015481565b6040519081526020015b60405180910390f35b61005a61007b366004610162565b60006020819052908152604090205481565b6100a061009b366004610162565b6100ee565b005b6100c97f000000000000000000000000f6beeebb578e214ca9e23b0e9683454ff88ed2a781565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610064565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000f6beeebb578e214ca9e23b0e9683454ff88ed2a7161461015d576040517fb49365dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600155565b60006020828403121561017457600080fd5b503591905056fea2646970667358221220a187fc278346c1b61c449ea3641002b6eac2bda3351a122a12c35099f933696864736f6c63430008110033"
62
- },
63
- {
64
- "contractName": "PolygonZkEVMGlobalExitRootL2 proxy",
65
- "balance": "0",
66
- "nonce": "1",
67
- "address": "0xa40d5f56745a118d0906a34e69aec8c0db1cb8fa",
68
- "bytecode": "0x60806040526004361061004e5760003560e01c80633659cfe6146100655780634f1ef286146100855780635c60da1b146100985780638f283970146100c9578063f851a440146100e95761005d565b3661005d5761005b6100fe565b005b61005b6100fe565b34801561007157600080fd5b5061005b6100803660046106ca565b610118565b61005b6100933660046106e5565b61015f565b3480156100a457600080fd5b506100ad6101d0565b6040516001600160a01b03909116815260200160405180910390f35b3480156100d557600080fd5b5061005b6100e43660046106ca565b61020b565b3480156100f557600080fd5b506100ad610235565b610106610292565b610116610111610331565b61033b565b565b61012061035f565b6001600160a01b0316336001600160a01b031614156101575761015481604051806020016040528060008152506000610392565b50565b6101546100fe565b61016761035f565b6001600160a01b0316336001600160a01b031614156101c8576101c38383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610392915050565b505050565b6101c36100fe565b60006101da61035f565b6001600160a01b0316336001600160a01b03161415610200576101fb610331565b905090565b6102086100fe565b90565b61021361035f565b6001600160a01b0316336001600160a01b0316141561015757610154816103f1565b600061023f61035f565b6001600160a01b0316336001600160a01b03161415610200576101fb61035f565b606061028583836040518060600160405280602781526020016107e460279139610445565b9392505050565b3b151590565b61029a61035f565b6001600160a01b0316336001600160a01b031614156101165760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b60006101fb610519565b3660008037600080366000845af43d6000803e80801561035a573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b61039b83610541565b6040516001600160a01b038416907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a26000825111806103dc5750805b156101c3576103eb8383610260565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61041a61035f565b604080516001600160a01b03928316815291841660208301520160405180910390a1610154816105e9565b6060833b6104a45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610328565b600080856001600160a01b0316856040516104bf9190610794565b600060405180830381855af49150503d80600081146104fa576040519150601f19603f3d011682016040523d82523d6000602084013e6104ff565b606091505b509150915061050f828286610675565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610383565b803b6105a55760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610328565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc5b80546001600160a01b0319166001600160a01b039290921691909117905550565b6001600160a01b03811661064e5760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610328565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61036105c8565b60608315610684575081610285565b8251156106945782518084602001fd5b8160405162461bcd60e51b815260040161032891906107b0565b80356001600160a01b03811681146106c557600080fd5b919050565b6000602082840312156106dc57600080fd5b610285826106ae565b6000806000604084860312156106fa57600080fd5b610703846106ae565b9250602084013567ffffffffffffffff8082111561072057600080fd5b818601915086601f83011261073457600080fd5b81358181111561074357600080fd5b87602082850101111561075557600080fd5b6020830194508093505050509250925092565b60005b8381101561078357818101518382015260200161076b565b838111156103eb5750506000910152565b600082516107a6818460208701610768565b9190910192915050565b60208152600082518060208401526107cf816040850160208701610768565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212204675187caf3a43285d9a2c1844a981e977bd52a85ff073e7fc649f73847d70a464736f6c63430008090033",
69
- "storage": {
70
- "0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103": "0x00000000000000000000000040797c2f93298a44a893f43edf1b33b63d7ba333",
71
- "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc": "0x00000000000000000000000077fc57b154fcf8320df2c2e6c044aa50141c023b"
72
- }
73
- },
74
- {
75
- "contractName": "PolygonZkEVMTimelock",
76
- "balance": "0",
77
- "nonce": "1",
78
- "address": "0x02245d7B6CB0b6870d1e28AC877EE355b9588869",
79
- "bytecode": "0x6080604052600436106101c65760003560e01c806364d62353116100f7578063b1c5f42711610095578063d547741f11610064578063d547741f14610661578063e38335e514610681578063f23a6e6114610694578063f27a0c92146106d957600080fd5b8063b1c5f427146105af578063bc197c81146105cf578063c4d252f514610614578063d45c44351461063457600080fd5b80638f61f4f5116100d15780638f61f4f5146104e157806391d1485414610515578063a217fddf14610566578063b08e51c01461057b57600080fd5b806364d62353146104815780638065657f146104a15780638f2a0bb0146104c157600080fd5b8063248a9ca31161016457806331d507501161013e57806331d50750146103c857806336568abe146103e85780633a6aae7214610408578063584b153e1461046157600080fd5b8063248a9ca3146103475780632ab0f529146103775780632f2ff15d146103a857600080fd5b80630d3cf6fc116101a05780630d3cf6fc1461026b578063134008d31461029f57806313bc9f20146102b2578063150b7a02146102d257600080fd5b806301d5062a146101d257806301ffc9a7146101f457806307bd02651461022957600080fd5b366101cd57005b600080fd5b3480156101de57600080fd5b506101f26101ed366004611c12565b6106ee565b005b34801561020057600080fd5b5061021461020f366004611c87565b610783565b60405190151581526020015b60405180910390f35b34801561023557600080fd5b5061025d7fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e6381565b604051908152602001610220565b34801561027757600080fd5b5061025d7f5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca581565b6101f26102ad366004611cc9565b6107df565b3480156102be57600080fd5b506102146102cd366004611d35565b6108d7565b3480156102de57600080fd5b506103166102ed366004611e5a565b7f150b7a0200000000000000000000000000000000000000000000000000000000949350505050565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610220565b34801561035357600080fd5b5061025d610362366004611d35565b60009081526020819052604090206001015490565b34801561038357600080fd5b50610214610392366004611d35565b6000908152600160208190526040909120541490565b3480156103b457600080fd5b506101f26103c3366004611ec2565b6108fd565b3480156103d457600080fd5b506102146103e3366004611d35565b610927565b3480156103f457600080fd5b506101f2610403366004611ec2565b610940565b34801561041457600080fd5b5061043c7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610220565b34801561046d57600080fd5b5061021461047c366004611d35565b6109f8565b34801561048d57600080fd5b506101f261049c366004611d35565b610a0e565b3480156104ad57600080fd5b5061025d6104bc366004611cc9565b610ade565b3480156104cd57600080fd5b506101f26104dc366004611f33565b610b1d565b3480156104ed57600080fd5b5061025d7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc181565b34801561052157600080fd5b50610214610530366004611ec2565b60009182526020828152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b34801561057257600080fd5b5061025d600081565b34801561058757600080fd5b5061025d7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f78381565b3480156105bb57600080fd5b5061025d6105ca366004611fe5565b610d4f565b3480156105db57600080fd5b506103166105ea36600461210e565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b34801561062057600080fd5b506101f261062f366004611d35565b610d94565b34801561064057600080fd5b5061025d61064f366004611d35565b60009081526001602052604090205490565b34801561066d57600080fd5b506101f261067c366004611ec2565b610e8f565b6101f261068f366004611fe5565b610eb4565b3480156106a057600080fd5b506103166106af3660046121b8565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b3480156106e557600080fd5b5061025d611161565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc161071881611204565b6000610728898989898989610ade565b90506107348184611211565b6000817f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8b8b8b8b8b8a60405161077096959493929190612266565b60405180910390a3505050505050505050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e00000000000000000000000000000000000000000000000000000000014806107d957506107d98261135e565b92915050565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff1661085c5761085c81336113f5565b600061086c888888888888610ade565b905061087881856114ad565b610884888888886115ea565b6000817fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588a8a8a8a6040516108bc94939291906122b1565b60405180910390a36108cd816116ee565b5050505050505050565b6000818152600160205260408120546001811180156108f65750428111155b9392505050565b60008281526020819052604090206001015461091881611204565b6109228383611797565b505050565b60008181526001602052604081205481905b1192915050565b73ffffffffffffffffffffffffffffffffffffffff811633146109ea576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6109f48282611887565b5050565b6000818152600160208190526040822054610939565b333014610a9d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f54696d656c6f636b436f6e74726f6c6c65723a2063616c6c6572206d7573742060448201527f62652074696d656c6f636b00000000000000000000000000000000000000000060648201526084016109e1565b60025460408051918252602082018390527f11c24f4ead16507c69ac467fbd5e4eed5fb5c699626d2cc6d66421df253886d5910160405180910390a1600255565b6000868686868686604051602001610afb96959493929190612266565b6040516020818303038152906040528051906020012090509695505050505050565b7fb09aa5aeb3702cfd50b6b62bc4532604938f21248a27a1d5ca736082b6819cc1610b4781611204565b888714610bd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b888514610c65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b6000610c778b8b8b8b8b8b8b8b610d4f565b9050610c838184611211565b60005b8a811015610d415780827f4cf4410cc57040e44862ef0f45f3dd5a5e02db8eb8add648d4b0e236f1d07dca8e8e85818110610cc357610cc36122f1565b9050602002016020810190610cd89190612320565b8d8d86818110610cea57610cea6122f1565b905060200201358c8c87818110610d0357610d036122f1565b9050602002810190610d15919061233b565b8c8b604051610d2996959493929190612266565b60405180910390a3610d3a816123cf565b9050610c86565b505050505050505050505050565b60008888888888888888604051602001610d709897969594939291906124b7565b60405160208183030381529060405280519060200120905098975050505050505050565b7ffd643c72710c63c0180259aba6b2d05451e3591a24e58b62239378085726f783610dbe81611204565b610dc7826109f8565b610e53576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603160248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20636160448201527f6e6e6f742062652063616e63656c6c656400000000000000000000000000000060648201526084016109e1565b6000828152600160205260408082208290555183917fbaa1eb22f2a492ba1a5fea61b8df4d27c6c8b5f3971e63bb58fa14ff72eedb7091a25050565b600082815260208190526040902060010154610eaa81611204565b6109228383611887565b600080527fdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d70696020527f5ba6852781629bcdcd4bdaa6de76d786f1c64b16acdac474e55bebc0ea157951547fd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e639060ff16610f3157610f3181336113f5565b878614610fc0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b87841461104f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f54696d656c6f636b436f6e74726f6c6c65723a206c656e677468206d69736d6160448201527f746368000000000000000000000000000000000000000000000000000000000060648201526084016109e1565b60006110618a8a8a8a8a8a8a8a610d4f565b905061106d81856114ad565b60005b8981101561114b5760008b8b8381811061108c5761108c6122f1565b90506020020160208101906110a19190612320565b905060008a8a848181106110b7576110b76122f1565b9050602002013590503660008a8a868181106110d5576110d56122f1565b90506020028101906110e7919061233b565b915091506110f7848484846115ea565b84867fc2617efa69bab66782fa219543714338489c4e9e178271560a91b82c3f612b588686868660405161112e94939291906122b1565b60405180910390a35050505080611144906123cf565b9050611070565b50611155816116ee565b50505050505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166315064c966040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111f2919061257e565b156111fd5750600090565b5060025490565b61120e81336113f5565b50565b61121a82610927565b156112a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20616c60448201527f7265616479207363686564756c6564000000000000000000000000000000000060648201526084016109e1565b6112af611161565b81101561133e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a20696e73756666696369656e7460448201527f2064656c6179000000000000000000000000000000000000000000000000000060648201526084016109e1565b61134881426125a0565b6000928352600160205260409092209190915550565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806107d957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107d9565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f4576114338161193e565b61143e83602061195d565b60405160200161144f9291906125d7565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526109e191600401612658565b6114b6826108d7565b611542576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b80158061155e5750600081815260016020819052604090912054145b6109f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f54696d656c6f636b436f6e74726f6c6c65723a206d697373696e67206465706560448201527f6e64656e6379000000000000000000000000000000000000000000000000000060648201526084016109e1565b60008473ffffffffffffffffffffffffffffffffffffffff168484846040516116149291906126a9565b60006040518083038185875af1925050503d8060008114611651576040519150601f19603f3d011682016040523d82523d6000602084013e611656565b606091505b50509050806116e7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f54696d656c6f636b436f6e74726f6c6c65723a20756e6465726c79696e67207460448201527f72616e73616374696f6e2072657665727465640000000000000000000000000060648201526084016109e1565b5050505050565b6116f7816108d7565b611783576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f54696d656c6f636b436f6e74726f6c6c65723a206f7065726174696f6e20697360448201527f206e6f742072656164790000000000000000000000000000000000000000000060648201526084016109e1565b600090815260016020819052604090912055565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790556118293390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff16156109f45760008281526020818152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606107d973ffffffffffffffffffffffffffffffffffffffff831660145b6060600061196c8360026126b9565b6119779060026125a0565b67ffffffffffffffff81111561198f5761198f611d4e565b6040519080825280601f01601f1916602001820160405280156119b9576020820181803683370190505b5090507f3000000000000000000000000000000000000000000000000000000000000000816000815181106119f0576119f06122f1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f780000000000000000000000000000000000000000000000000000000000000081600181518110611a5357611a536122f1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053506000611a8f8460026126b9565b611a9a9060016125a0565b90505b6001811115611b37577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110611adb57611adb6122f1565b1a60f81b828281518110611af157611af16122f1565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c93611b30816126d0565b9050611a9d565b5083156108f6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109e1565b803573ffffffffffffffffffffffffffffffffffffffff81168114611bc457600080fd5b919050565b60008083601f840112611bdb57600080fd5b50813567ffffffffffffffff811115611bf357600080fd5b602083019150836020828501011115611c0b57600080fd5b9250929050565b600080600080600080600060c0888a031215611c2d57600080fd5b611c3688611ba0565b965060208801359550604088013567ffffffffffffffff811115611c5957600080fd5b611c658a828b01611bc9565b989b979a50986060810135976080820135975060a09091013595509350505050565b600060208284031215611c9957600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146108f657600080fd5b60008060008060008060a08789031215611ce257600080fd5b611ceb87611ba0565b955060208701359450604087013567ffffffffffffffff811115611d0e57600080fd5b611d1a89828a01611bc9565b979a9699509760608101359660809091013595509350505050565b600060208284031215611d4757600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715611dc457611dc4611d4e565b604052919050565b600082601f830112611ddd57600080fd5b813567ffffffffffffffff811115611df757611df7611d4e565b611e2860207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601611d7d565b818152846020838601011115611e3d57600080fd5b816020850160208301376000918101602001919091529392505050565b60008060008060808587031215611e7057600080fd5b611e7985611ba0565b9350611e8760208601611ba0565b925060408501359150606085013567ffffffffffffffff811115611eaa57600080fd5b611eb687828801611dcc565b91505092959194509250565b60008060408385031215611ed557600080fd5b82359150611ee560208401611ba0565b90509250929050565b60008083601f840112611f0057600080fd5b50813567ffffffffffffffff811115611f1857600080fd5b6020830191508360208260051b8501011115611c0b57600080fd5b600080600080600080600080600060c08a8c031215611f5157600080fd5b893567ffffffffffffffff80821115611f6957600080fd5b611f758d838e01611eee565b909b50995060208c0135915080821115611f8e57600080fd5b611f9a8d838e01611eee565b909950975060408c0135915080821115611fb357600080fd5b50611fc08c828d01611eee565b9a9d999c50979a969997986060880135976080810135975060a0013595509350505050565b60008060008060008060008060a0898b03121561200157600080fd5b883567ffffffffffffffff8082111561201957600080fd5b6120258c838d01611eee565b909a50985060208b013591508082111561203e57600080fd5b61204a8c838d01611eee565b909850965060408b013591508082111561206357600080fd5b506120708b828c01611eee565b999c989b509699959896976060870135966080013595509350505050565b600082601f83011261209f57600080fd5b8135602067ffffffffffffffff8211156120bb576120bb611d4e565b8160051b6120ca828201611d7d565b92835284810182019282810190878511156120e457600080fd5b83870192505b84831015612103578235825291830191908301906120ea565b979650505050505050565b600080600080600060a0868803121561212657600080fd5b61212f86611ba0565b945061213d60208701611ba0565b9350604086013567ffffffffffffffff8082111561215a57600080fd5b61216689838a0161208e565b9450606088013591508082111561217c57600080fd5b61218889838a0161208e565b9350608088013591508082111561219e57600080fd5b506121ab88828901611dcc565b9150509295509295909350565b600080600080600060a086880312156121d057600080fd5b6121d986611ba0565b94506121e760208701611ba0565b93506040860135925060608601359150608086013567ffffffffffffffff81111561221157600080fd5b6121ab88828901611dcc565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b73ffffffffffffffffffffffffffffffffffffffff8716815285602082015260a06040820152600061229c60a08301868861221d565b60608301949094525060800152949350505050565b73ffffffffffffffffffffffffffffffffffffffff851681528360208201526060604082015260006122e760608301848661221d565b9695505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561233257600080fd5b6108f682611ba0565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261237057600080fd5b83018035915067ffffffffffffffff82111561238b57600080fd5b602001915036819003821315611c0b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612400576124006123a0565b5060010190565b81835260006020808501808196508560051b810191508460005b878110156124aa57828403895281357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe188360301811261246057600080fd5b8701858101903567ffffffffffffffff81111561247c57600080fd5b80360382131561248b57600080fd5b61249686828461221d565b9a87019a9550505090840190600101612421565b5091979650505050505050565b60a0808252810188905260008960c08301825b8b8110156125055773ffffffffffffffffffffffffffffffffffffffff6124f084611ba0565b168252602092830192909101906001016124ca565b5083810360208501528881527f07ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff89111561253e57600080fd5b8860051b9150818a602083013701828103602090810160408501526125669082018789612407565b60608401959095525050608001529695505050505050565b60006020828403121561259057600080fd5b815180151581146108f657600080fd5b808201808211156107d9576107d96123a0565b60005b838110156125ce5781810151838201526020016125b6565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161260f8160178501602088016125b3565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835161264c8160288401602088016125b3565b01602801949350505050565b60208152600082518060208401526126778160408501602087016125b3565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b8183823760009101908152919050565b80820281158282048414176107d9576107d96123a0565b6000816126df576126df6123a0565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea2646970667358221220288c3dd40a2ba96edf066502722584177809ebdb47c0cf9ee8df6f07954c373064736f6c63430008110033",
80
- "storage": {
81
- "0x0000000000000000000000000000000000000000000000000000000000000002": "0x0000000000000000000000000000000000000000000000000000000000015180",
82
- "0xbdd73c6ebfb442c137537be0985acf11af8e6133078bc51ef9094071cb0ca475": "0x0000000000000000000000000000000000000000000000000000000000000001",
83
- "0x92b79801e6a3d148a516c908cc0bbad93771fa74468b7757a14aa55532d092de": "0x0000000000000000000000000000000000000000000000000000000000000001",
84
- "0x64494413541ff93b31aa309254e3fed72a7456e9845988b915b4c7a7ceba8814": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5",
85
- "0x43e090632490f7d46c400129311fff008a7688bb3d4aebdf80607456b452cf04": "0x0000000000000000000000000000000000000000000000000000000000000001",
86
- "0x3412d5605ac6cd444957cedb533e5dacad6378b4bc819ebe3652188a665066d6": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5",
87
- "0x5af21cf0316499c6925cf9be0331b8bd150a1fa4c19d24a043b45f0cf15357c3": "0x0000000000000000000000000000000000000000000000000000000000000001",
88
- "0xdae2aa361dfd1ca020a396615627d436107c35eff9fe7738a3512819782d706a": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5",
89
- "0xaf021eeb38644155cd697b3ce0ec4fdac818d29c448a9f9d9bafc293723c6cd8": "0x0000000000000000000000000000000000000000000000000000000000000001",
90
- "0xc3ad33e20b0c56a223ad5104fff154aa010f8715b9c981fd38fdc60a4d1a52fc": "0x5f58e3a2316349923ce3780f8d587db2d72378aed66a8261c916544fa6846ca5"
91
- }
92
- },
93
- {
94
- "accountName": "keyless Deployer",
95
- "balance": "0",
96
- "nonce": "1",
97
- "address": "0xB83a574B3966F7dc1d38d162FA154F2A57D608Bb"
98
- },
99
- {
100
- "accountName": "deployer",
101
- "balance": "0",
102
- "nonce": "8",
103
- "address": "0xA0B02B28920812324f1cC3255bd8840867d3f227"
104
- }
105
- ]
106
- }
107
-
108
- `
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
{/home/stefan/go/src/Polygon/zkevm-node → .}/config/types/duration.go RENAMED
@@ -38,3 +38,13 @@
38
  },
39
  }
40
  }
 
 
 
 
 
 
 
 
 
 
 
38
  },
39
  }
40
  }
41
+
42
+ // MarshalJSON marshalls time duration into text.
43
+ func (d Duration) MarshalJSON() ([]byte, error) {
44
+ return []byte(`"` + d.String() + `"`), nil
45
+ }
46
+
47
+ // MarshalText marshalls time duration into text.
48
+ func (d *Duration) MarshalText() ([]byte, error) {
49
+ return []byte(d.String()), nil
50
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/config.go RENAMED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ package dataavailability
2
+
3
+ // DABackendType is the data availability protocol for the CDK
4
+ type DABackendType string
5
+
6
+ const (
7
+ // DataAvailabilityCommittee is the DAC protocol backend
8
+ DataAvailabilityCommittee DABackendType = "DataAvailabilityCommittee"
9
+ )
{/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/dataavailability.go RENAMED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package dataavailability
2
+
3
+ import (
4
+ "context"
5
+ "fmt"
6
+ "math/big"
7
+
8
+ "github.com/0xPolygonHermez/zkevm-node/etherman/types"
9
+ "github.com/0xPolygonHermez/zkevm-node/log"
10
+ "github.com/0xPolygonHermez/zkevm-node/state"
11
+ "github.com/ethereum/go-ethereum/common"
12
+ "github.com/ethereum/go-ethereum/crypto"
13
+ )
14
+
15
+ const unexpectedHashTemplate = "missmatch on transaction data for batch num %d. Expected hash %s, actual hash: %s"
16
+
17
+ // DataAvailability implements an abstract data availability integration
18
+ type DataAvailability struct {
19
+ isTrustedSequencer bool
20
+
21
+ state stateInterface
22
+ zkEVMClient ZKEVMClientTrustedBatchesGetter
23
+ backend DABackender
24
+
25
+ ctx context.Context
26
+ }
27
+
28
+ // New creates a DataAvailability instance
29
+ func New(
30
+ isTrustedSequencer bool,
31
+ backend DABackender,
32
+ state stateInterface,
33
+ zkEVMClient ZKEVMClientTrustedBatchesGetter,
34
+ ) (*DataAvailability, error) {
35
+ da := &DataAvailability{
36
+ isTrustedSequencer: isTrustedSequencer,
37
+ backend: backend,
38
+ state: state,
39
+ zkEVMClient: zkEVMClient,
40
+ ctx: context.Background(),
41
+ }
42
+ err := da.backend.Init()
43
+ return da, err
44
+ }
45
+
46
+ // PostSequence sends the sequence data to the data availability backend, and returns the dataAvailabilityMessage
47
+ // as expected by the contract
48
+ func (d *DataAvailability) PostSequence(ctx context.Context, sequences []types.Sequence) ([]byte, error) {
49
+ batchesData := [][]byte{}
50
+ for _, batch := range sequences {
51
+ // Do not send to the DA backend data that will be stored to L1
52
+ if batch.ForcedBatchTimestamp == 0 {
53
+ batchesData = append(batchesData, batch.BatchL2Data)
54
+ }
55
+ }
56
+ return d.backend.PostSequence(ctx, batchesData)
57
+ }
58
+
59
+ // GetBatchL2Data tries to return the data from a batch, in the following priorities
60
+ // 1. From local DB
61
+ // 2. From Sequencer
62
+ // 3. From DA backend
63
+ func (d *DataAvailability) GetBatchL2Data(batchNum uint64, expectedTransactionsHash common.Hash) ([]byte, error) {
64
+ found := true
65
+ transactionsData, err := d.state.GetBatchL2DataByNumber(d.ctx, batchNum, nil)
66
+ if err != nil {
67
+ if err == state.ErrNotFound {
68
+ found = false
69
+ } else {
70
+ return nil, fmt.Errorf("failed to get batch data from state for batch num %d: %w", batchNum, err)
71
+ }
72
+ }
73
+ actualTransactionsHash := crypto.Keccak256Hash(transactionsData)
74
+ if !found || expectedTransactionsHash != actualTransactionsHash {
75
+ if found {
76
+ log.Warnf(unexpectedHashTemplate, batchNum, expectedTransactionsHash, actualTransactionsHash)
77
+ }
78
+
79
+ if !d.isTrustedSequencer {
80
+ log.Info("trying to get data from trusted sequencer")
81
+ data, err := d.getDataFromTrustedSequencer(batchNum, expectedTransactionsHash)
82
+ if err != nil {
83
+ log.Warn("failed to get data from trusted sequencer: %w", err)
84
+ } else {
85
+ return data, nil
86
+ }
87
+ }
88
+
89
+ log.Info("trying to get data from the data availability backend")
90
+ data, err := d.backend.GetBatchL2Data(batchNum, expectedTransactionsHash)
91
+ if err != nil {
92
+ log.Error("failed to get data from the data availability backend: %w", err)
93
+ if d.isTrustedSequencer {
94
+ return nil, fmt.Errorf("data not found on the local DB nor on any data committee member")
95
+ } else {
96
+ return nil, fmt.Errorf("data not found on the local DB, nor from the trusted sequencer nor on any data committee member")
97
+ }
98
+ }
99
+ return data, nil
100
+ }
101
+ return transactionsData, nil
102
+ }
103
+
104
+ func (d *DataAvailability) getDataFromTrustedSequencer(batchNum uint64, expectedTransactionsHash common.Hash) ([]byte, error) {
105
+ b, err := d.zkEVMClient.BatchByNumber(d.ctx, new(big.Int).SetUint64(batchNum))
106
+ if err != nil {
107
+ return nil, fmt.Errorf("failed to get batch num %d from trusted sequencer: %w", batchNum, err)
108
+ }
109
+ actualTransactionsHash := crypto.Keccak256Hash(b.BatchL2Data)
110
+ if expectedTransactionsHash != actualTransactionsHash {
111
+ return nil, fmt.Errorf(
112
+ unexpectedHashTemplate, batchNum, expectedTransactionsHash, actualTransactionsHash,
113
+ )
114
+ }
115
+ return b.BatchL2Data, nil
116
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/datacommittee/datacommittee.go RENAMED
@@ -0,0 +1,295 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package datacommittee
2
+
3
+ import (
4
+ "crypto/ecdsa"
5
+ "errors"
6
+ "fmt"
7
+ "math/big"
8
+ "math/rand"
9
+ "sort"
10
+ "strings"
11
+
12
+ "github.com/0xPolygon/cdk-data-availability/client"
13
+ daTypes "github.com/0xPolygon/cdk-data-availability/types"
14
+ "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygondatacommittee"
15
+ "github.com/0xPolygonHermez/zkevm-node/log"
16
+ "github.com/ethereum/go-ethereum/accounts/abi/bind"
17
+ "github.com/ethereum/go-ethereum/common"
18
+ "github.com/ethereum/go-ethereum/crypto"
19
+ "github.com/ethereum/go-ethereum/ethclient"
20
+ "golang.org/x/net/context"
21
+ )
22
+
23
+ const unexpectedHashTemplate = "missmatch on transaction data for batch num %d. Expected hash %s, actual hash: %s"
24
+
25
+ // DataCommitteeMember represents a member of the Data Committee
26
+ type DataCommitteeMember struct {
27
+ Addr common.Address
28
+ URL string
29
+ }
30
+
31
+ // DataCommittee represents a specific committee
32
+ type DataCommittee struct {
33
+ AddressesHash common.Hash
34
+ Members []DataCommitteeMember
35
+ RequiredSignatures uint64
36
+ }
37
+
38
+ // DataCommitteeBackend implements the DAC integration
39
+ type DataCommitteeBackend struct {
40
+ dataCommitteeContract *polygondatacommittee.Polygondatacommittee
41
+ privKey *ecdsa.PrivateKey
42
+ dataCommitteeClientFactory client.Factory
43
+
44
+ committeeMembers []DataCommitteeMember
45
+ selectedCommitteeMember int
46
+ ctx context.Context
47
+ }
48
+
49
+ // New creates an instance of DataCommitteeBackend
50
+ func New(
51
+ l1RPCURL string,
52
+ dataCommitteeAddr common.Address,
53
+ privKey *ecdsa.PrivateKey,
54
+ dataCommitteeClientFactory client.Factory,
55
+ ) (*DataCommitteeBackend, error) {
56
+ ethClient, err := ethclient.Dial(l1RPCURL)
57
+ if err != nil {
58
+ log.Errorf("error connecting to %s: %+v", l1RPCURL, err)
59
+ return nil, err
60
+ }
61
+ dataCommittee, err := polygondatacommittee.NewPolygondatacommittee(dataCommitteeAddr, ethClient)
62
+ if err != nil {
63
+ return nil, err
64
+ }
65
+ return &DataCommitteeBackend{
66
+ dataCommitteeContract: dataCommittee,
67
+ privKey: privKey,
68
+ dataCommitteeClientFactory: dataCommitteeClientFactory,
69
+ ctx: context.Background(),
70
+ }, nil
71
+ }
72
+
73
+ // Init loads the DAC to be cached when needed
74
+ func (d *DataCommitteeBackend) Init() error {
75
+ committee, err := d.getCurrentDataCommittee()
76
+ if err != nil {
77
+ return err
78
+ }
79
+ selectedCommitteeMember := -1
80
+ if committee != nil {
81
+ d.committeeMembers = committee.Members
82
+ if len(committee.Members) > 0 {
83
+ selectedCommitteeMember = rand.Intn(len(committee.Members)) //nolint:gosec
84
+ }
85
+ }
86
+ d.selectedCommitteeMember = selectedCommitteeMember
87
+ return nil
88
+ }
89
+
90
+ // GetBatchL2Data returns the data from the DAC. It checks that it matches with the expected hash
91
+ func (d *DataCommitteeBackend) GetBatchL2Data(batchNum uint64, hash common.Hash) ([]byte, error) {
92
+ intialMember := d.selectedCommitteeMember
93
+ found := false
94
+ for !found && intialMember != -1 {
95
+ member := d.committeeMembers[d.selectedCommitteeMember]
96
+ log.Infof("trying to get data from %s at %s", member.Addr.Hex(), member.URL)
97
+ c := d.dataCommitteeClientFactory.New(member.URL)
98
+ data, err := c.GetOffChainData(d.ctx, hash)
99
+ if err != nil {
100
+ log.Warnf(
101
+ "error getting data from DAC node %s at %s: %s",
102
+ member.Addr.Hex(), member.URL, err,
103
+ )
104
+ d.selectedCommitteeMember = (d.selectedCommitteeMember + 1) % len(d.committeeMembers)
105
+ if d.selectedCommitteeMember == intialMember {
106
+ break
107
+ }
108
+ continue
109
+ }
110
+ actualTransactionsHash := crypto.Keccak256Hash(data)
111
+ if actualTransactionsHash != hash {
112
+ unexpectedHash := fmt.Errorf(
113
+ unexpectedHashTemplate, batchNum, hash, actualTransactionsHash,
114
+ )
115
+ log.Warnf(
116
+ "error getting data from DAC node %s at %s: %s",
117
+ member.Addr.Hex(), member.URL, unexpectedHash,
118
+ )
119
+ d.selectedCommitteeMember = (d.selectedCommitteeMember + 1) % len(d.committeeMembers)
120
+ if d.selectedCommitteeMember == intialMember {
121
+ break
122
+ }
123
+ continue
124
+ }
125
+ return data, nil
126
+ }
127
+ if err := d.Init(); err != nil {
128
+ return nil, fmt.Errorf("error loading data committee: %s", err)
129
+ }
130
+ return nil, fmt.Errorf("couldn't get the data from any committee member")
131
+ }
132
+
133
+ type signatureMsg struct {
134
+ addr common.Address
135
+ signature []byte
136
+ err error
137
+ }
138
+
139
+ // PostSequence sends the sequence data to the data availability backend, and returns the dataAvailabilityMessage
140
+ // as expected by the contract
141
+ func (s *DataCommitteeBackend) PostSequence(ctx context.Context, batchesData [][]byte) ([]byte, error) {
142
+ // Get current committee
143
+ committee, err := s.getCurrentDataCommittee()
144
+ if err != nil {
145
+ return nil, err
146
+ }
147
+
148
+ // Authenticate as trusted sequencer by signing the sequences
149
+ sequence := daTypes.Sequence{}
150
+ for _, seq := range batchesData {
151
+ sequence = append(sequence, seq)
152
+ }
153
+ signedSequence, err := sequence.Sign(s.privKey)
154
+ if err != nil {
155
+ return nil, err
156
+ }
157
+
158
+ // Request signatures to all members in parallel
159
+ ch := make(chan signatureMsg, len(committee.Members))
160
+ signatureCtx, cancelSignatureCollection := context.WithCancel(ctx)
161
+ for _, member := range committee.Members {
162
+ go requestSignatureFromMember(signatureCtx, *signedSequence, member, ch)
163
+ }
164
+
165
+ // Collect signatures
166
+ msgs := []signatureMsg{}
167
+ var (
168
+ collectedSignatures uint64
169
+ failedToCollect uint64
170
+ )
171
+ for collectedSignatures < committee.RequiredSignatures {
172
+ msg := <-ch
173
+ if msg.err != nil {
174
+ log.Errorf("error when trying to get signature from %s: %s", msg.addr, msg.err)
175
+ failedToCollect++
176
+ if len(committee.Members)-int(failedToCollect) < int(committee.RequiredSignatures) {
177
+ cancelSignatureCollection()
178
+ return nil, errors.New("too many members failed to send their signature")
179
+ }
180
+ } else {
181
+ log.Infof("received signature from %s", msg.addr)
182
+ collectedSignatures++
183
+ }
184
+ msgs = append(msgs, msg)
185
+ }
186
+
187
+ // Stop requesting as soon as we have N valid signatures
188
+ cancelSignatureCollection()
189
+
190
+ return buildSignaturesAndAddrs(signatureMsgs(msgs), committee.Members), nil
191
+ }
192
+
193
+ func requestSignatureFromMember(ctx context.Context, signedSequence daTypes.SignedSequence, member DataCommitteeMember, ch chan signatureMsg) {
194
+ // request
195
+ c := client.New(member.URL)
196
+ log.Infof("sending request to sign the sequence to %s at %s", member.Addr.Hex(), member.URL)
197
+ signature, err := c.SignSequence(signedSequence)
198
+ if err != nil {
199
+ ch <- signatureMsg{
200
+ addr: member.Addr,
201
+ err: err,
202
+ }
203
+ return
204
+ }
205
+ // verify returned signature
206
+ signedSequence.Signature = signature
207
+ signer, err := signedSequence.Signer()
208
+ if err != nil {
209
+ ch <- signatureMsg{
210
+ addr: member.Addr,
211
+ err: err,
212
+ }
213
+ return
214
+ }
215
+ if signer != member.Addr {
216
+ ch <- signatureMsg{
217
+ addr: member.Addr,
218
+ err: fmt.Errorf("invalid signer. Expected %s, actual %s", member.Addr.Hex(), signer.Hex()),
219
+ }
220
+ return
221
+ }
222
+ ch <- signatureMsg{
223
+ addr: member.Addr,
224
+ signature: signature,
225
+ }
226
+ }
227
+
228
+ func buildSignaturesAndAddrs(sigs signatureMsgs, members []DataCommitteeMember) []byte {
229
+ const (
230
+ sigLen = 65
231
+ addrLen = 20
232
+ )
233
+ res := make([]byte, 0, len(sigs)*sigLen+len(members)*addrLen)
234
+ sort.Sort(sigs)
235
+ for _, msg := range sigs {
236
+ log.Debugf("adding signature %s from %s", common.Bytes2Hex(msg.signature), msg.addr.Hex())
237
+ res = append(res, msg.signature...)
238
+ }
239
+ for _, member := range members {
240
+ log.Debugf("adding addr %s", common.Bytes2Hex(member.Addr.Bytes()))
241
+ res = append(res, member.Addr.Bytes()...)
242
+ }
243
+ log.Debugf("full res %s", common.Bytes2Hex(res))
244
+ return res
245
+ }
246
+
247
+ type signatureMsgs []signatureMsg
248
+
249
+ func (s signatureMsgs) Len() int { return len(s) }
250
+ func (s signatureMsgs) Less(i, j int) bool {
251
+ return strings.ToUpper(s[i].addr.Hex()) < strings.ToUpper(s[j].addr.Hex())
252
+ }
253
+ func (s signatureMsgs) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
254
+
255
+ // getCurrentDataCommittee return the currently registered data committee
256
+ func (d *DataCommitteeBackend) getCurrentDataCommittee() (*DataCommittee, error) {
257
+ addrsHash, err := d.dataCommitteeContract.CommitteeHash(&bind.CallOpts{Pending: false})
258
+ if err != nil {
259
+ return nil, fmt.Errorf("error getting CommitteeHash from L1 SC: %w", err)
260
+ }
261
+ reqSign, err := d.dataCommitteeContract.RequiredAmountOfSignatures(&bind.CallOpts{Pending: false})
262
+ if err != nil {
263
+ return nil, fmt.Errorf("error getting RequiredAmountOfSignatures from L1 SC: %w", err)
264
+ }
265
+ members, err := d.getCurrentDataCommitteeMembers()
266
+ if err != nil {
267
+ return nil, err
268
+ }
269
+
270
+ return &DataCommittee{
271
+ AddressesHash: common.Hash(addrsHash),
272
+ RequiredSignatures: reqSign.Uint64(),
273
+ Members: members,
274
+ }, nil
275
+ }
276
+
277
+ // getCurrentDataCommitteeMembers return the currently registered data committee members
278
+ func (d *DataCommitteeBackend) getCurrentDataCommitteeMembers() ([]DataCommitteeMember, error) {
279
+ nMembers, err := d.dataCommitteeContract.GetAmountOfMembers(&bind.CallOpts{Pending: false})
280
+ if err != nil {
281
+ return nil, fmt.Errorf("error getting GetAmountOfMembers from L1 SC: %w", err)
282
+ }
283
+ members := make([]DataCommitteeMember, 0, nMembers.Int64())
284
+ for i := int64(0); i < nMembers.Int64(); i++ {
285
+ member, err := d.dataCommitteeContract.Members(&bind.CallOpts{Pending: false}, big.NewInt(i))
286
+ if err != nil {
287
+ return nil, fmt.Errorf("error getting Members %d from L1 SC: %w", i, err)
288
+ }
289
+ members = append(members, DataCommitteeMember{
290
+ Addr: member.Addr,
291
+ URL: member.Url,
292
+ })
293
+ }
294
+ return members, nil
295
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/datacommittee/datacommittee_test.go RENAMED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package datacommittee
2
+
3
+ import (
4
+ "math/big"
5
+ "testing"
6
+
7
+ "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygondatacommittee"
8
+ "github.com/0xPolygonHermez/zkevm-node/log"
9
+ "github.com/ethereum/go-ethereum/accounts/abi/bind"
10
+ "github.com/ethereum/go-ethereum/common"
11
+ "github.com/ethereum/go-ethereum/core"
12
+ "github.com/ethereum/go-ethereum/crypto"
13
+ "github.com/ethereum/go-ethereum/ethclient/simulated"
14
+ "github.com/stretchr/testify/assert"
15
+ "github.com/stretchr/testify/require"
16
+ )
17
+
18
+ func TestUpdateDataCommitteeEvent(t *testing.T) {
19
+ // Set up testing environment
20
+ dac, ethBackend, auth, da := newTestingEnv(t)
21
+
22
+ // Update the committee
23
+ requiredAmountOfSignatures := big.NewInt(2)
24
+ URLs := []string{"1", "2", "3"}
25
+ addrs := []common.Address{
26
+ common.HexToAddress("0x1"),
27
+ common.HexToAddress("0x2"),
28
+ common.HexToAddress("0x3"),
29
+ }
30
+ addrsBytes := []byte{}
31
+ for _, addr := range addrs {
32
+ addrsBytes = append(addrsBytes, addr.Bytes()...)
33
+ }
34
+ _, err := da.SetupCommittee(auth, requiredAmountOfSignatures, URLs, addrsBytes)
35
+ require.NoError(t, err)
36
+ ethBackend.Commit()
37
+
38
+ // Assert the committee update
39
+ actualSetup, err := dac.getCurrentDataCommittee()
40
+ require.NoError(t, err)
41
+ expectedMembers := []DataCommitteeMember{}
42
+ expectedSetup := DataCommittee{
43
+ RequiredSignatures: uint64(len(URLs) - 1),
44
+ AddressesHash: crypto.Keccak256Hash(addrsBytes),
45
+ }
46
+ for i, url := range URLs {
47
+ expectedMembers = append(expectedMembers, DataCommitteeMember{
48
+ URL: url,
49
+ Addr: addrs[i],
50
+ })
51
+ }
52
+ expectedSetup.Members = expectedMembers
53
+ assert.Equal(t, expectedSetup, *actualSetup)
54
+ }
55
+
56
+ func init() {
57
+ log.Init(log.Config{
58
+ Level: "debug",
59
+ Outputs: []string{"stderr"},
60
+ })
61
+ }
62
+
63
+ // This function prepare the blockchain, the wallet with funds and deploy the smc
64
+ func newTestingEnv(t *testing.T) (
65
+ dac *DataCommitteeBackend,
66
+ ethBackend *simulated.Backend,
67
+ auth *bind.TransactOpts,
68
+ da *polygondatacommittee.Polygondatacommittee,
69
+ ) {
70
+ t.Helper()
71
+ privateKey, err := crypto.GenerateKey()
72
+ if err != nil {
73
+ log.Fatal(err)
74
+ }
75
+ auth, err = bind.NewKeyedTransactorWithChainID(privateKey, big.NewInt(1337))
76
+ if err != nil {
77
+ log.Fatal(err)
78
+ }
79
+ dac, ethBackend, da, err = newSimulatedDacman(t, auth)
80
+ if err != nil {
81
+ log.Fatal(err)
82
+ }
83
+ return dac, ethBackend, auth, da
84
+ }
85
+
86
+ // NewSimulatedEtherman creates an etherman that uses a simulated blockchain. It's important to notice that the ChainID of the auth
87
+ // must be 1337. The address that holds the auth will have an initial balance of 10 ETH
88
+ func newSimulatedDacman(t *testing.T, auth *bind.TransactOpts) (
89
+ dacman *DataCommitteeBackend,
90
+ ethBackend *simulated.Backend,
91
+ da *polygondatacommittee.Polygondatacommittee,
92
+ err error,
93
+ ) {
94
+ t.Helper()
95
+ if auth == nil {
96
+ // read only client
97
+ return &DataCommitteeBackend{}, nil, nil, nil
98
+ }
99
+ // 10000000 ETH in wei
100
+ balance, _ := new(big.Int).SetString("10000000000000000000000000", 10) //nolint:gomnd
101
+ address := auth.From
102
+ genesisAlloc := map[common.Address]core.GenesisAccount{
103
+ address: {
104
+ Balance: balance,
105
+ },
106
+ }
107
+ blockGasLimit := uint64(999999999999999999) //nolint:gomnd
108
+ client := simulated.NewBackend(genesisAlloc, simulated.WithBlockGasLimit(blockGasLimit))
109
+
110
+ // DAC Setup
111
+ _, _, da, err = polygondatacommittee.DeployPolygondatacommittee(auth, client.Client())
112
+ if err != nil {
113
+ return &DataCommitteeBackend{}, nil, nil, err
114
+ }
115
+ client.Commit()
116
+ _, err = da.Initialize(auth)
117
+ if err != nil {
118
+ return &DataCommitteeBackend{}, nil, nil, err
119
+ }
120
+ client.Commit()
121
+ _, err = da.SetupCommittee(auth, big.NewInt(0), []string{}, []byte{})
122
+ if err != nil {
123
+ return &DataCommitteeBackend{}, nil, nil, err
124
+ }
125
+ client.Commit()
126
+
127
+ c := &DataCommitteeBackend{
128
+ dataCommitteeContract: da,
129
+ }
130
+ return c, client, da, nil
131
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/dataavailability/interfaces.go RENAMED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package dataavailability
2
+
3
+ import (
4
+ "context"
5
+ "math/big"
6
+
7
+ "github.com/0xPolygonHermez/zkevm-node/jsonrpc/types"
8
+ "github.com/0xPolygonHermez/zkevm-node/state"
9
+ "github.com/ethereum/go-ethereum/common"
10
+ "github.com/jackc/pgx/v4"
11
+ )
12
+
13
+ type stateInterface interface {
14
+ GetBatchL2DataByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) ([]byte, error)
15
+ GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error)
16
+ }
17
+
18
+ // BatchDataProvider is used to retrieve batch data
19
+ type BatchDataProvider interface {
20
+ // GetBatchL2Data retrieve the data of a batch from the DA backend. The returned data must be the pre-image of the hash
21
+ GetBatchL2Data(batchNum uint64, hash common.Hash) ([]byte, error)
22
+ }
23
+
24
+ // SequenceSender is used to send provided sequence of batches
25
+ type SequenceSender interface {
26
+ // PostSequence sends the sequence data to the data availability backend, and returns the dataAvailabilityMessage
27
+ // as expected by the contract
28
+ PostSequence(ctx context.Context, batchesData [][]byte) ([]byte, error)
29
+ }
30
+
31
+ // DABackender is the interface needed to implement in order to
32
+ // integrate a DA service
33
+ type DABackender interface {
34
+ BatchDataProvider
35
+ SequenceSender
36
+ // Init initializes the DABackend
37
+ Init() error
38
+ }
39
+
40
+ // ZKEVMClientTrustedBatchesGetter contains the methods required to interact with zkEVM-RPC
41
+ type ZKEVMClientTrustedBatchesGetter interface {
42
+ BatchByNumber(ctx context.Context, number *big.Int) (*types.Batch, error)
43
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/db/migrations/pool/validium-001.sql RENAMED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -- +migrate Down
2
+ DROP TABLE IF EXISTS pool.acl CASCADE;
3
+ DROP TABLE IF EXISTS pool.policy CASCADE;
4
+
5
+ -- +migrate Up
6
+ CREATE TABLE pool.policy
7
+ (
8
+ name VARCHAR PRIMARY KEY,
9
+ allow BOOLEAN NOT NULL DEFAULT false
10
+ );
11
+
12
+ INSERT INTO pool.policy (name, allow) VALUES ('send_tx', false);
13
+ INSERT INTO pool.policy (name, allow) VALUES ('deploy', false);
14
+
15
+ CREATE TABLE pool.acl
16
+ (
17
+ address VARCHAR,
18
+ policy VARCHAR,
19
+ PRIMARY KEY (address, policy)
20
+ );
{/home/stefan/go/src/Polygon/zkevm-node → .}/diffgen.sh RENAMED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PATH_TO_ZKEVM_NODE_REPO="/home/stefan/go/src/Polygon/zkevm-node/"
2
+ diff -ruN \
3
+ -I ".*github.com\/0x.*" \
4
+ -x "*mock*" -x ".git" \
5
+ -x ".github" \
6
+ -x ".gitignore" \
7
+ -x ".vscode" \
8
+ -x "ci" \
9
+ -x "environments" \
10
+ -x "*.md" \
11
+ -x "*.html" \
12
+ -x "*.html" \
13
+ -x "*.json" \
14
+ -x "*.toml" \
15
+ -x "*.abi" \
16
+ -x "*.bin" \
17
+ -x "*.pb.go" \
18
+ -x "smartcontracts" \
19
+ -x "go.sum" \
20
+ -x "mock*.go" \
21
+ -x "*venv*" \
22
+ -x "/dist/" \
23
+ -x "/test/e2e/keystore" \
24
+ -x "/test/vectors/src/**/*md" \
25
+ -x "/test/vectors/src/**/*js" \
26
+ -x "/test/vectors/src/**/*sol" \
27
+ -x "/test/vectors/src/**/*sh" \
28
+ -x "/test/vectors/src/package.json" \
29
+ -x "/test/contracts/bin/**/*.bin" \
30
+ -x "/test/contracts/bin/**/*.abi" \
31
+ -x "/tools/datastreamer/*.bin" \
32
+ -x "/test/datastreamer/*.db/*" \
33
+ -x "/test/*.bin" \
34
+ -x "/test/*.db/*" \
35
+ -x "**/.DS_Store" \
36
+ -x ".vscode" \
37
+ -x ".idea/" \
38
+ -x ".env" \
39
+ -x "out.dat" \
40
+ -x "cmd/__debug_bin" \
41
+ -x ".venv" \
42
+ -x "*metrics.txt" \
43
+ -x "coverage.out" \
44
+ -x "*datastream.db*" \
45
+ ${PATH_TO_ZKEVM_NODE_REPO} . | \
46
+ diff2html -i stdin -s side -t "zkEVM node vs CDK validium node</br><h2>zkevm-node version: v0.6.0<h2/>" \
47
+ -F ./docs/diff/diff.html
{/home/stefan/go/src/Polygon/zkevm-node → .}/Dockerfile RENAMED
@@ -14,7 +14,6 @@
14
  # CONTAINER FOR RUNNING BINARY
15
  FROM alpine:3.18
16
  COPY --from=build /src/dist/zkevm-node /app/zkevm-node
17
- COPY --from=build /src/config/environments/testnet/node.config.toml /app/example.config.toml
18
  RUN apk update && apk add postgresql15-client
19
  EXPOSE 8123
20
  CMD ["/bin/sh", "-c", "/app/zkevm-node run"]
 
14
  # CONTAINER FOR RUNNING BINARY
15
  FROM alpine:3.18
16
  COPY --from=build /src/dist/zkevm-node /app/zkevm-node
 
17
  RUN apk update && apk add postgresql15-client
18
  EXPOSE 8123
19
  CMD ["/bin/sh", "-c", "/app/zkevm-node run"]
{/home/stefan/go/src/Polygon/zkevm-node → .}/Dockerfile.release RENAMED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM alpine:3.16.0
2
+
3
+ EXPOSE 8123
4
+
5
+ COPY zkevm-node /usr/local/bin
6
+
7
+ RUN addgroup -S zkevm-group \
8
+ && adduser -S zkevm-user -G zkevm-group
9
+
10
+ USER zkevm-user
11
+
12
+ ENTRYPOINT ["zkevm-node"]
{/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/etherman.go RENAMED
@@ -1,8 +1,8 @@
1
  package etherman
2
 
3
  import (
4
- "bytes"
5
  "context"
 
6
  "encoding/json"
7
  "errors"
8
  "fmt"
@@ -156,7 +158,6 @@
156
  ethereum.LogFilterer
157
  ethereum.TransactionReader
158
  ethereum.TransactionSender
159
- ethereum.PendingStateReader
160
 
161
  bind.DeployBackend
162
  }
@@ -190,6 +191,7 @@
190
  GlobalExitRootManager *polygonzkevmglobalexitroot.Polygonzkevmglobalexitroot
191
  OldGlobalExitRootManager *oldpolygonzkevmglobalexitroot.Oldpolygonzkevmglobalexitroot
192
  Pol *pol.Pol
 
193
  SCAddresses []common.Address
194
 
195
  RollupID uint32
@@ -199,10 +201,12 @@
199
  l1Cfg L1Config
200
  cfg Config
201
  auth map[common.Address]bind.TransactOpts // empty in case of read-only client
 
 
202
  }
203
 
204
  // NewClient creates a new etherman.
205
- func NewClient(cfg Config, l1Config L1Config) (*Client, error) {
206
  // Connect to ethereum node
207
  ethClient, err := ethclient.Dial(cfg.URL)
208
  if err != nil {
@@ -245,6 +249,14 @@
245
  log.Errorf("error creating NewPol client (%s). Error: %w", l1Config.PolAddr.String(), err)
246
  return nil, err
247
  }
 
 
 
 
 
 
 
 
248
  var scAddresses []common.Address
249
  scAddresses = append(scAddresses, l1Config.ZkEVMAddr, l1Config.RollupManagerAddr, l1Config.GlobalExitRootManagerAddr)
250
 
@@ -262,8 +274,8 @@
262
  // Get RollupID
263
  rollupID, err := rollupManager.RollupAddressToID(&bind.CallOpts{Pending: false}, l1Config.ZkEVMAddr)
264
  if err != nil {
265
- log.Errorf("error rollupManager.cRollupAddressToID(%s). Error: %w", l1Config.RollupManagerAddr, err)
266
- return nil, err
267
  }
268
  log.Debug("rollupID: ", rollupID)
269
 
@@ -275,6 +287,7 @@
275
  RollupManager: rollupManager,
276
  Pol: pol,
277
  GlobalExitRootManager: globalExitRoot,
 
278
  OldGlobalExitRootManager: oldGlobalExitRoot,
279
  SCAddresses: scAddresses,
280
  RollupID: rollupID,
@@ -285,6 +298,7 @@
285
  l1Cfg: l1Config,
286
  cfg: cfg,
287
  auth: map[common.Address]bind.TransactOpts{},
 
288
  }, nil
289
  }
290
 
@@ -345,6 +359,11 @@
345
  log.Debug("Getting forkIDs from blockNumber: ", genBlockNumber)
346
  start := time.Now()
347
  var logs []types.Log
 
 
 
 
 
348
  log.Debug("Using ForkIDChunkSize: ", etherMan.cfg.ForkIDChunkSize)
349
  for i := genBlockNumber; i <= lastL1BlockSynced; i = i + etherMan.cfg.ForkIDChunkSize + 1 {
350
  final := i + etherMan.cfg.ForkIDChunkSize
@@ -684,64 +703,19 @@
684
  if etherMan.RollupID != addExistingRollup.RollupID {
685
  return nil
686
  }
687
- return etherMan.updateForkId(ctx, vLog, blocks, blocksOrder, addExistingRollup.LastVerifiedBatchBeforeUpgrade, addExistingRollup.ForkID, "")
688
- }
689
-
690
- func (etherMan *Client) updateEtrogSequence(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error {
691
- log.Debug("updateEtrogSequence event detected")
692
- updateEtrogSequence, err := etherMan.EtrogZKEVM.ParseUpdateEtrogSequence(vLog)
693
- if err != nil {
694
- log.Error("error parsing updateEtrogSequence event. Error: ", err)
695
- return err
696
- }
697
-
698
- // Read the tx for this event.
699
- tx, err := etherMan.EthClient.TransactionInBlock(ctx, vLog.BlockHash, vLog.TxIndex)
700
- if err != nil {
701
- return err
702
- }
703
- if tx.Hash() != vLog.TxHash {
704
- return fmt.Errorf("error: tx hash mismatch. want: %s have: %s", vLog.TxHash, tx.Hash().String())
705
- }
706
- msg, err := core.TransactionToMessage(tx, types.NewLondonSigner(tx.ChainId()), big.NewInt(0))
707
  if err != nil {
 
708
  return err
709
  }
710
- fullBlock, err := etherMan.EthClient.BlockByHash(ctx, vLog.BlockHash)
711
- if err != nil {
712
- return fmt.Errorf("error getting fullBlockInfo. BlockNumber: %d. Error: %w", vLog.BlockNumber, err)
713
- }
714
 
715
- log.Info("update Etrog transaction sequence...")
716
- sequence := UpdateEtrogSequence{
717
- BatchNumber: updateEtrogSequence.NumBatch,
718
- SequencerAddr: updateEtrogSequence.Sequencer,
719
- TxHash: vLog.TxHash,
720
- Nonce: msg.Nonce,
721
- PolygonRollupBaseEtrogBatchData: &polygonzkevm.PolygonRollupBaseEtrogBatchData{
722
- Transactions: updateEtrogSequence.Transactions,
723
- ForcedGlobalExitRoot: updateEtrogSequence.LastGlobalExitRoot,
724
- ForcedTimestamp: fullBlock.Time(),
725
- ForcedBlockHashL1: fullBlock.ParentHash(),
726
- },
727
- }
728
 
729
- if len(*blocks) == 0 || ((*blocks)[len(*blocks)-1].BlockHash != vLog.BlockHash || (*blocks)[len(*blocks)-1].BlockNumber != vLog.BlockNumber) {
730
- block := prepareBlock(vLog, time.Unix(int64(fullBlock.Time()), 0), fullBlock)
731
- block.UpdateEtrogSequence = sequence
732
- *blocks = append(*blocks, block)
733
- } else if (*blocks)[len(*blocks)-1].BlockHash == vLog.BlockHash && (*blocks)[len(*blocks)-1].BlockNumber == vLog.BlockNumber {
734
- (*blocks)[len(*blocks)-1].UpdateEtrogSequence = sequence
735
- } else {
736
- log.Error("Error processing UpdateEtrogSequence event. BlockHash:", vLog.BlockHash, ". BlockNumber: ", vLog.BlockNumber)
737
- return fmt.Errorf("error processing UpdateEtrogSequence event")
738
- }
739
- or := Order{
740
- Name: UpdateEtrogSequenceOrder,
741
- Pos: 0,
742
- }
743
- (*blocksOrder)[(*blocks)[len(*blocks)-1].BlockHash] = append((*blocksOrder)[(*blocks)[len(*blocks)-1].BlockHash], or)
744
- return nil
745
  }
746
 
747
  func (etherMan *Client) initialSequenceBatches(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error {
@@ -936,14 +910,14 @@
936
  }
937
 
938
  // EstimateGasSequenceBatches estimates gas for sending batches
939
- func (etherMan *Client) EstimateGasSequenceBatches(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address) (*types.Transaction, error) {
940
  opts, err := etherMan.getAuthByAddress(sender)
941
  if err == ErrNotFound {
942
  return nil, ErrPrivateKeyNotFound
943
  }
944
  opts.NoSend = true
945
 
946
- tx, err := etherMan.sequenceBatches(opts, sequences, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase)
947
  if err != nil {
948
  return nil, err
949
  }
@@ -952,7 +926,7 @@
952
  }
953
 
954
  // BuildSequenceBatchesTxData builds a []bytes to be sent to the PoE SC method SequenceBatches.
955
- func (etherMan *Client) BuildSequenceBatchesTxData(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address) (to *common.Address, data []byte, err error) {
956
  opts, err := etherMan.getAuthByAddress(sender)
957
  if err == ErrNotFound {
958
  return nil, nil, fmt.Errorf("failed to build sequence batches, err: %w", ErrPrivateKeyNotFound)
@@ -963,7 +937,7 @@
963
  opts.GasLimit = uint64(1)
964
  opts.GasPrice = big.NewInt(1)
965
 
966
- tx, err := etherMan.sequenceBatches(opts, sequences, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase)
967
  if err != nil {
968
  return nil, nil, err
969
  }
@@ -971,15 +945,15 @@
971
  return tx.To(), tx.Data(), nil
972
  }
973
 
974
- func (etherMan *Client) sequenceBatches(opts bind.TransactOpts, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address) (*types.Transaction, error) {
975
- var batches []polygonzkevm.PolygonRollupBaseEtrogBatchData
976
  for _, seq := range sequences {
977
  var ger common.Hash
978
  if seq.ForcedBatchTimestamp > 0 {
979
  ger = seq.GlobalExitRoot
980
  }
981
- batch := polygonzkevm.PolygonRollupBaseEtrogBatchData{
982
- Transactions: seq.BatchL2Data,
983
  ForcedGlobalExitRoot: ger,
984
  ForcedTimestamp: uint64(seq.ForcedBatchTimestamp),
985
  ForcedBlockHashL1: seq.PrevBlockHash,
@@ -988,7 +962,7 @@
988
  batches = append(batches, batch)
989
  }
990
 
991
- tx, err := etherMan.ZkEVM.SequenceBatches(&opts, batches, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase)
992
  if err != nil {
993
  log.Debugf("Batches to send: %+v", batches)
994
  log.Debug("l2CoinBase: ", l2Coinbase)
@@ -997,7 +971,7 @@
997
  if err2 != nil {
998
  log.Error("error getting abi. Error: ", err2)
999
  }
1000
- input, err3 := a.Pack("sequenceBatches", batches, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase)
1001
  if err3 != nil {
1002
  log.Error("error packing call. Error: ", err3)
1003
  }
@@ -1206,20 +1180,9 @@
1206
 
1207
  var sequences []SequencedBatch
1208
  if sb.NumBatch != 1 {
1209
- methodId := tx.Data()[:4]
1210
- log.Debugf("MethodId: %s", common.Bytes2Hex(methodId))
1211
- if bytes.Equal(methodId, methodIDSequenceBatchesEtrog) {
1212
- sequences, err = decodeSequencesEtrog(tx.Data(), sb.NumBatch, msg.From, vLog.TxHash, msg.Nonce, sb.L1InfoRoot)
1213
- if err != nil {
1214
- return fmt.Errorf("error decoding the sequences (etrog): %v", err)
1215
- }
1216
- } else if bytes.Equal(methodId, methodIDSequenceBatchesElderberry) {
1217
- sequences, err = decodeSequencesElderberry(tx.Data(), sb.NumBatch, msg.From, vLog.TxHash, msg.Nonce, sb.L1InfoRoot)
1218
- if err != nil {
1219
- return fmt.Errorf("error decoding the sequences (elderberry): %v", err)
1220
- }
1221
- } else {
1222
- return fmt.Errorf("error decoding the sequences: methodId %s unknown", common.Bytes2Hex(methodId))
1223
  }
1224
  } else {
1225
  log.Info("initial transaction sequence...")
@@ -1300,7 +1263,7 @@
1300
  return nil
1301
  }
1302
 
1303
- func decodeSequencesElderberry(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64, l1InfoRoot common.Hash) ([]SequencedBatch, error) {
1304
  // Extract coded txs.
1305
  // Load contract ABI
1306
  smcAbi, err := abi.JSON(strings.NewReader(polygonzkevm.PolygonzkevmABI))
@@ -1319,87 +1282,69 @@
1319
  if err != nil {
1320
  return nil, err
1321
  }
1322
- var sequences []polygonzkevm.PolygonRollupBaseEtrogBatchData
1323
  bytedata, err := json.Marshal(data[0])
1324
  if err != nil {
1325
  return nil, err
1326
  }
1327
- err = json.Unmarshal(bytedata, &sequences)
1328
- if err != nil {
1329
- return nil, err
1330
- }
1331
- maxSequenceTimestamp := data[1].(uint64)
1332
- initSequencedBatchNumber := data[2].(uint64)
1333
- coinbase := (data[3]).(common.Address)
1334
- sequencedBatches := make([]SequencedBatch, len(sequences))
1335
-
1336
- for i, seq := range sequences {
1337
- elderberry := SequencedBatchElderberryData{
1338
- MaxSequenceTimestamp: maxSequenceTimestamp,
1339
- InitSequencedBatchNumber: initSequencedBatchNumber,
1340
  }
1341
- bn := lastBatchNumber - uint64(len(sequences)-(i+1))
1342
- s := seq
1343
- sequencedBatches[i] = SequencedBatch{
1344
- BatchNumber: bn,
1345
- L1InfoRoot: &l1InfoRoot,
1346
- SequencerAddr: sequencer,
1347
- TxHash: txHash,
1348
- Nonce: nonce,
1349
- Coinbase: coinbase,
1350
- PolygonRollupBaseEtrogBatchData: &s,
1351
- SequencedBatchElderberryData: &elderberry,
 
 
 
1352
  }
1353
- }
1354
-
1355
- return sequencedBatches, nil
1356
- }
1357
 
1358
- func decodeSequencesEtrog(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64, l1InfoRoot common.Hash) ([]SequencedBatch, error) {
1359
- // Extract coded txs.
1360
- // Load contract ABI
1361
- smcAbi, err := abi.JSON(strings.NewReader(etrogpolygonzkevm.EtrogpolygonzkevmABI))
1362
- if err != nil {
1363
- return nil, err
1364
- }
1365
-
1366
- // Recover Method from signature and ABI
1367
- method, err := smcAbi.MethodById(txData[:4])
1368
- if err != nil {
1369
- return nil, err
1370
- }
1371
-
1372
- // Unpack method inputs
1373
- data, err := method.Inputs.Unpack(txData[4:])
1374
- if err != nil {
1375
- return nil, err
1376
- }
1377
- var sequences []polygonzkevm.PolygonRollupBaseEtrogBatchData
1378
- bytedata, err := json.Marshal(data[0])
1379
- if err != nil {
1380
- return nil, err
1381
- }
1382
- err = json.Unmarshal(bytedata, &sequences)
1383
- if err != nil {
1384
- return nil, err
1385
- }
1386
- coinbase := (data[1]).(common.Address)
1387
- sequencedBatches := make([]SequencedBatch, len(sequences))
1388
- for i, seq := range sequences {
1389
- bn := lastBatchNumber - uint64(len(sequences)-(i+1))
1390
- s := seq
1391
- sequencedBatches[i] = SequencedBatch{
1392
- BatchNumber: bn,
1393
- L1InfoRoot: &l1InfoRoot,
1394
- SequencerAddr: sequencer,
1395
- TxHash: txHash,
1396
- Nonce: nonce,
1397
- Coinbase: coinbase,
1398
- PolygonRollupBaseEtrogBatchData: &s,
1399
  }
1400
- }
1401
 
1402
- return sequencedBatches, nil
 
 
 
1403
  }
1404
 
1405
  func decodeSequencesPreEtrog(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64) ([]SequencedBatch, error) {
@@ -1638,11 +1583,18 @@
1638
 
1639
  // GetLatestBatchNumber function allows to retrieve the latest proposed batch in the smc
1640
  func (etherMan *Client) GetLatestBatchNumber() (uint64, error) {
 
1641
  rollupData, err := etherMan.RollupManager.RollupIDToRollupData(&bind.CallOpts{Pending: false}, etherMan.RollupID)
1642
  if err != nil {
1643
- return 0, err
 
 
 
 
 
 
1644
  }
1645
- return rollupData.LastBatchSequenced, nil
1646
  }
1647
 
1648
  // GetLatestBlockHeader gets the latest block header from the ethereum
@@ -1689,11 +1641,18 @@
1689
 
1690
  // GetLatestVerifiedBatchNum gets latest verified batch from ethereum
1691
  func (etherMan *Client) GetLatestVerifiedBatchNum() (uint64, error) {
 
1692
  rollupData, err := etherMan.RollupManager.RollupIDToRollupData(&bind.CallOpts{Pending: false}, etherMan.RollupID)
1693
  if err != nil {
1694
- return 0, err
 
 
 
 
 
 
1695
  }
1696
- return rollupData.LastVerifiedBatch, nil
1697
  }
1698
 
1699
  // GetTx function get ethereum tx
@@ -1728,7 +1687,15 @@
1728
 
1729
  // GetTrustedSequencerURL Gets the trusted sequencer url from rollup smc
1730
  func (etherMan *Client) GetTrustedSequencerURL() (string, error) {
1731
- return etherMan.ZkEVM.TrustedSequencerURL(&bind.CallOpts{Pending: false})
 
 
 
 
 
 
 
 
1732
  }
1733
 
1734
  // GetL2ChainID returns L2 Chain ID
@@ -1771,11 +1738,6 @@
1771
  return etherMan.EthClient.SendTransaction(ctx, tx)
1772
  }
1773
 
1774
- // PendingNonce returns the pending nonce for the provided account
1775
- func (etherMan *Client) PendingNonce(ctx context.Context, account common.Address) (uint64, error) {
1776
- return etherMan.EthClient.PendingNonceAt(ctx, account)
1777
- }
1778
-
1779
  // CurrentNonce returns the current nonce for the provided account
1780
  func (etherMan *Client) CurrentNonce(ctx context.Context, account common.Address) (uint64, error) {
1781
  return etherMan.EthClient.NonceAt(ctx, account, nil)
@@ -1854,15 +1816,15 @@
1854
  }
1855
 
1856
  // LoadAuthFromKeyStore loads an authorization from a key store file
1857
- func (etherMan *Client) LoadAuthFromKeyStore(path, password string) (*bind.TransactOpts, error) {
1858
- auth, err := newAuthFromKeystore(path, password, etherMan.l1Cfg.L1ChainID)
1859
  if err != nil {
1860
- return nil, err
1861
  }
1862
 
1863
  log.Infof("loaded authorization for address: %v", auth.From.String())
1864
  etherMan.auth[auth.From] = auth
1865
- return &auth, nil
1866
  }
1867
 
1868
  // newKeyFromKeystore creates an instance of a keystore key from a keystore file
@@ -1883,20 +1845,20 @@
1883
  }
1884
 
1885
  // newAuthFromKeystore an authorization instance from a keystore file
1886
- func newAuthFromKeystore(path, password string, chainID uint64) (bind.TransactOpts, error) {
1887
  log.Infof("reading key from: %v", path)
1888
  key, err := newKeyFromKeystore(path, password)
1889
  if err != nil {
1890
- return bind.TransactOpts{}, err
1891
  }
1892
  if key == nil {
1893
- return bind.TransactOpts{}, nil
1894
  }
1895
  auth, err := bind.NewKeyedTransactorWithChainID(key.PrivateKey, new(big.Int).SetUint64(chainID))
1896
  if err != nil {
1897
- return bind.TransactOpts{}, err
1898
  }
1899
- return *auth, nil
1900
  }
1901
 
1902
  // getAuthByAddress tries to get an authorization from the authorizations map
@@ -1924,3 +1886,28 @@
1924
 
1925
  return *auth, nil
1926
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  package etherman
2
 
3
  import (
 
4
  "context"
5
+ "crypto/ecdsa"
6
  "encoding/json"
7
  "errors"
8
  "fmt"
 
158
  ethereum.LogFilterer
159
  ethereum.TransactionReader
160
  ethereum.TransactionSender
 
161
 
162
  bind.DeployBackend
163
  }
 
191
  GlobalExitRootManager *polygonzkevmglobalexitroot.Polygonzkevmglobalexitroot
192
  OldGlobalExitRootManager *oldpolygonzkevmglobalexitroot.Oldpolygonzkevmglobalexitroot
193
  Pol *pol.Pol
194
+ DAProtocol *dataavailabilityprotocol.Dataavailabilityprotocol
195
  SCAddresses []common.Address
196
 
197
  RollupID uint32
 
201
  l1Cfg L1Config
202
  cfg Config
203
  auth map[common.Address]bind.TransactOpts // empty in case of read-only client
204
+
205
+ da dataavailability.BatchDataProvider
206
  }
207
 
208
  // NewClient creates a new etherman.
209
+ func NewClient(cfg Config, l1Config L1Config, da dataavailability.BatchDataProvider) (*Client, error) {
210
  // Connect to ethereum node
211
  ethClient, err := ethclient.Dial(cfg.URL)
212
  if err != nil {
 
249
  log.Errorf("error creating NewPol client (%s). Error: %w", l1Config.PolAddr.String(), err)
250
  return nil, err
251
  }
252
+ dapAddr, err := zkevm.DataAvailabilityProtocol(&bind.CallOpts{Pending: false})
253
+ if err != nil {
254
+ return nil, err
255
+ }
256
+ dap, err := dataavailabilityprotocol.NewDataavailabilityprotocol(dapAddr, ethClient)
257
+ if err != nil {
258
+ return nil, err
259
+ }
260
  var scAddresses []common.Address
261
  scAddresses = append(scAddresses, l1Config.ZkEVMAddr, l1Config.RollupManagerAddr, l1Config.GlobalExitRootManagerAddr)
262
 
 
274
  // Get RollupID
275
  rollupID, err := rollupManager.RollupAddressToID(&bind.CallOpts{Pending: false}, l1Config.ZkEVMAddr)
276
  if err != nil {
277
+ log.Debugf("error rollupManager.RollupAddressToID(%s). Error: %w", l1Config.RollupManagerAddr, err)
278
+ // TODO return error after the upgrade
279
  }
280
  log.Debug("rollupID: ", rollupID)
281
 
 
287
  RollupManager: rollupManager,
288
  Pol: pol,
289
  GlobalExitRootManager: globalExitRoot,
290
+ DAProtocol: dap,
291
  OldGlobalExitRootManager: oldGlobalExitRoot,
292
  SCAddresses: scAddresses,
293
  RollupID: rollupID,
 
298
  l1Cfg: l1Config,
299
  cfg: cfg,
300
  auth: map[common.Address]bind.TransactOpts{},
301
+ da: da,
302
  }, nil
303
  }
304
 
 
359
  log.Debug("Getting forkIDs from blockNumber: ", genBlockNumber)
360
  start := time.Now()
361
  var logs []types.Log
362
+
363
+ if lastL1BlockSynced < genBlockNumber {
364
+ lastL1BlockSynced = genBlockNumber
365
+ }
366
+
367
  log.Debug("Using ForkIDChunkSize: ", etherMan.cfg.ForkIDChunkSize)
368
  for i := genBlockNumber; i <= lastL1BlockSynced; i = i + etherMan.cfg.ForkIDChunkSize + 1 {
369
  final := i + etherMan.cfg.ForkIDChunkSize
 
703
  if etherMan.RollupID != addExistingRollup.RollupID {
704
  return nil
705
  }
706
+ // TODO Delete after upgrade Get RollupID
707
+ rollupID, err := etherMan.RollupManager.RollupAddressToID(&bind.CallOpts{Pending: false}, etherMan.SCAddresses[0])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
708
  if err != nil {
709
+ log.Error("error getting rollupID. Error: ", err)
710
  return err
711
  }
712
+ log.Debug("rollupID: ", rollupID)
 
 
 
713
 
714
+ return etherMan.updateForkId(ctx, vLog, blocks, blocksOrder, addExistingRollup.LastVerifiedBatchBeforeUpgrade, addExistingRollup.ForkID, "")
715
+ }
 
 
 
 
 
 
 
 
 
 
 
716
 
717
+ func (etherMan *Client) updateEtrogSequence(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error {
718
+ return errors.New("Upgrading validiums to etrog not supported")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
719
  }
720
 
721
  func (etherMan *Client) initialSequenceBatches(ctx context.Context, vLog types.Log, blocks *[]Block, blocksOrder *map[common.Hash][]Order) error {
 
910
  }
911
 
912
  // EstimateGasSequenceBatches estimates gas for sending batches
913
+ func (etherMan *Client) EstimateGasSequenceBatches(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address, dataAvailabilityMessage []byte) (*types.Transaction, error) {
914
  opts, err := etherMan.getAuthByAddress(sender)
915
  if err == ErrNotFound {
916
  return nil, ErrPrivateKeyNotFound
917
  }
918
  opts.NoSend = true
919
 
920
+ tx, err := etherMan.sequenceBatches(opts, sequences, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase, dataAvailabilityMessage)
921
  if err != nil {
922
  return nil, err
923
  }
 
926
  }
927
 
928
  // BuildSequenceBatchesTxData builds a []bytes to be sent to the PoE SC method SequenceBatches.
929
+ func (etherMan *Client) BuildSequenceBatchesTxData(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address, dataAvailabilityMessage []byte) (to *common.Address, data []byte, err error) {
930
  opts, err := etherMan.getAuthByAddress(sender)
931
  if err == ErrNotFound {
932
  return nil, nil, fmt.Errorf("failed to build sequence batches, err: %w", ErrPrivateKeyNotFound)
 
937
  opts.GasLimit = uint64(1)
938
  opts.GasPrice = big.NewInt(1)
939
 
940
+ tx, err := etherMan.sequenceBatches(opts, sequences, maxSequenceTimestamp, lastSequencedBatchNumber, l2Coinbase, dataAvailabilityMessage)
941
  if err != nil {
942
  return nil, nil, err
943
  }
 
945
  return tx.To(), tx.Data(), nil
946
  }
947
 
948
+ func (etherMan *Client) sequenceBatches(opts bind.TransactOpts, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, lastSequencedBatchNumber uint64, l2Coinbase common.Address, dataAvailabilityMessage []byte) (*types.Transaction, error) {
949
+ var batches []polygonzkevm.PolygonValidiumEtrogValidiumBatchData
950
  for _, seq := range sequences {
951
  var ger common.Hash
952
  if seq.ForcedBatchTimestamp > 0 {
953
  ger = seq.GlobalExitRoot
954
  }
955
+ batch := polygonzkevm.PolygonValidiumEtrogValidiumBatchData{
956
+ TransactionsHash: crypto.Keccak256Hash(seq.BatchL2Data),
957
  ForcedGlobalExitRoot: ger,
958
  ForcedTimestamp: uint64(seq.ForcedBatchTimestamp),
959
  ForcedBlockHashL1: seq.PrevBlockHash,
 
962
  batches = append(batches, batch)
963
  }
964
 
965
+ tx, err := etherMan.ZkEVM.SequenceBatchesValidium(&opts, batches, l2Coinbase, dataAvailabilityMessage)
966
  if err != nil {
967
  log.Debugf("Batches to send: %+v", batches)
968
  log.Debug("l2CoinBase: ", l2Coinbase)
 
971
  if err2 != nil {
972
  log.Error("error getting abi. Error: ", err2)
973
  }
974
+ input, err3 := a.Pack("sequenceBatches", batches, l2Coinbase)
975
  if err3 != nil {
976
  log.Error("error packing call. Error: ", err3)
977
  }
 
1180
 
1181
  var sequences []SequencedBatch
1182
  if sb.NumBatch != 1 {
1183
+ sequences, err = decodeSequences(tx.Data(), sb.NumBatch, msg.From, vLog.TxHash, msg.Nonce, sb.L1InfoRoot, etherMan.da)
1184
+ if err != nil {
1185
+ return fmt.Errorf("error decoding the sequences: %v", err)
 
 
 
 
 
 
 
 
 
 
 
1186
  }
1187
  } else {
1188
  log.Info("initial transaction sequence...")
 
1263
  return nil
1264
  }
1265
 
1266
+ func decodeSequences(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64, l1InfoRoot common.Hash, da dataavailability.BatchDataProvider) ([]SequencedBatch, error) {
1267
  // Extract coded txs.
1268
  // Load contract ABI
1269
  smcAbi, err := abi.JSON(strings.NewReader(polygonzkevm.PolygonzkevmABI))
 
1282
  if err != nil {
1283
  return nil, err
1284
  }
 
1285
  bytedata, err := json.Marshal(data[0])
1286
  if err != nil {
1287
  return nil, err
1288
  }
1289
+ var sequences []polygonzkevm.PolygonRollupBaseEtrogBatchData
1290
+ switch method.Name {
1291
+ case "rollup": // TODO: put correct value
1292
+ err = json.Unmarshal(bytedata, &sequences)
1293
+ if err != nil {
1294
+ return nil, err
 
 
 
 
 
 
 
1295
  }
1296
+ coinbase := (data[1]).(common.Address)
1297
+ sequencedBatches := make([]SequencedBatch, len(sequences))
1298
+ for i, seq := range sequences {
1299
+ bn := lastBatchNumber - uint64(len(sequences)-(i+1))
1300
+ s := seq
1301
+ sequencedBatches[i] = SequencedBatch{
1302
+ BatchNumber: bn,
1303
+ L1InfoRoot: &l1InfoRoot,
1304
+ SequencerAddr: sequencer,
1305
+ TxHash: txHash,
1306
+ Nonce: nonce,
1307
+ Coinbase: coinbase,
1308
+ PolygonRollupBaseEtrogBatchData: &s,
1309
+ }
1310
  }
 
 
 
 
1311
 
1312
+ return sequencedBatches, nil
1313
+ case "sequenceBatchesValidium":
1314
+ var sequencesValidium []polygonzkevm.PolygonValidiumEtrogValidiumBatchData
1315
+ err = json.Unmarshal(bytedata, &sequencesValidium)
1316
+ if err != nil {
1317
+ return nil, err
1318
+ }
1319
+ coinbase := (data[1]).(common.Address)
1320
+ sequencedBatches := make([]SequencedBatch, len(sequencesValidium))
1321
+ for i, seq := range sequencesValidium {
1322
+ bn := lastBatchNumber - uint64(len(sequencesValidium)-(i+1))
1323
+ batchL2Data, err := da.GetBatchL2Data(bn, sequencesValidium[i].TransactionsHash)
1324
+ if err != nil {
1325
+ return nil, err
1326
+ }
1327
+ s := polygonzkevm.PolygonRollupBaseEtrogBatchData{
1328
+ Transactions: batchL2Data, // TODO: get data from DA
1329
+ ForcedGlobalExitRoot: seq.ForcedGlobalExitRoot,
1330
+ ForcedTimestamp: seq.ForcedTimestamp,
1331
+ ForcedBlockHashL1: seq.ForcedBlockHashL1,
1332
+ }
1333
+ sequencedBatches[i] = SequencedBatch{
1334
+ BatchNumber: bn,
1335
+ L1InfoRoot: &l1InfoRoot,
1336
+ SequencerAddr: sequencer,
1337
+ TxHash: txHash,
1338
+ Nonce: nonce,
1339
+ Coinbase: coinbase,
1340
+ PolygonRollupBaseEtrogBatchData: &s,
1341
+ }
 
 
 
 
 
 
 
 
 
 
 
1342
  }
 
1343
 
1344
+ return sequencedBatches, nil
1345
+ default:
1346
+ return nil, fmt.Errorf("unexpected method called in sequence batches transaction: %s", method.RawName)
1347
+ }
1348
  }
1349
 
1350
  func decodeSequencesPreEtrog(txData []byte, lastBatchNumber uint64, sequencer common.Address, txHash common.Hash, nonce uint64) ([]SequencedBatch, error) {
 
1583
 
1584
  // GetLatestBatchNumber function allows to retrieve the latest proposed batch in the smc
1585
  func (etherMan *Client) GetLatestBatchNumber() (uint64, error) {
1586
+ var latestBatchNum uint64
1587
  rollupData, err := etherMan.RollupManager.RollupIDToRollupData(&bind.CallOpts{Pending: false}, etherMan.RollupID)
1588
  if err != nil {
1589
+ log.Debug("error getting latestBatchNum from rollupManager. Trying old zkevm smc... Error: ", err)
1590
+ latestBatchNum, err = etherMan.OldZkEVM.LastBatchSequenced(&bind.CallOpts{Pending: false})
1591
+ if err != nil {
1592
+ return latestBatchNum, err
1593
+ }
1594
+ } else {
1595
+ latestBatchNum = rollupData.LastBatchSequenced
1596
  }
1597
+ return latestBatchNum, nil
1598
  }
1599
 
1600
  // GetLatestBlockHeader gets the latest block header from the ethereum
 
1641
 
1642
  // GetLatestVerifiedBatchNum gets latest verified batch from ethereum
1643
  func (etherMan *Client) GetLatestVerifiedBatchNum() (uint64, error) {
1644
+ var lastVerifiedBatchNum uint64
1645
  rollupData, err := etherMan.RollupManager.RollupIDToRollupData(&bind.CallOpts{Pending: false}, etherMan.RollupID)
1646
  if err != nil {
1647
+ log.Debug("error getting lastVerifiedBatchNum from rollupManager. Trying old zkevm smc... Error: ", err)
1648
+ lastVerifiedBatchNum, err = etherMan.OldZkEVM.LastVerifiedBatch(&bind.CallOpts{Pending: false})
1649
+ if err != nil {
1650
+ return lastVerifiedBatchNum, err
1651
+ }
1652
+ } else {
1653
+ lastVerifiedBatchNum = rollupData.LastVerifiedBatch
1654
  }
1655
+ return lastVerifiedBatchNum, nil
1656
  }
1657
 
1658
  // GetTx function get ethereum tx
 
1687
 
1688
  // GetTrustedSequencerURL Gets the trusted sequencer url from rollup smc
1689
  func (etherMan *Client) GetTrustedSequencerURL() (string, error) {
1690
+ url, err := etherMan.ZkEVM.TrustedSequencerURL(&bind.CallOpts{Pending: false})
1691
+ //TODO: remove this code because is for compatibility with oldZkEVM
1692
+ if err != nil || url == "" {
1693
+ // Getting from oldZkEVM Contract
1694
+ log.Debug("getting trusted sequencer URL from oldZkevm smc")
1695
+ return etherMan.OldZkEVM.TrustedSequencerURL(&bind.CallOpts{Pending: false})
1696
+ }
1697
+ // err is always nil
1698
+ return url, nil
1699
  }
1700
 
1701
  // GetL2ChainID returns L2 Chain ID
 
1738
  return etherMan.EthClient.SendTransaction(ctx, tx)
1739
  }
1740
 
 
 
 
 
 
1741
  // CurrentNonce returns the current nonce for the provided account
1742
  func (etherMan *Client) CurrentNonce(ctx context.Context, account common.Address) (uint64, error) {
1743
  return etherMan.EthClient.NonceAt(ctx, account, nil)
 
1816
  }
1817
 
1818
  // LoadAuthFromKeyStore loads an authorization from a key store file
1819
+ func (etherMan *Client) LoadAuthFromKeyStore(path, password string) (*bind.TransactOpts, *ecdsa.PrivateKey, error) {
1820
+ auth, pk, err := newAuthFromKeystore(path, password, etherMan.l1Cfg.L1ChainID)
1821
  if err != nil {
1822
+ return nil, nil, err
1823
  }
1824
 
1825
  log.Infof("loaded authorization for address: %v", auth.From.String())
1826
  etherMan.auth[auth.From] = auth
1827
+ return &auth, pk, nil
1828
  }
1829
 
1830
  // newKeyFromKeystore creates an instance of a keystore key from a keystore file
 
1845
  }
1846
 
1847
  // newAuthFromKeystore an authorization instance from a keystore file
1848
+ func newAuthFromKeystore(path, password string, chainID uint64) (bind.TransactOpts, *ecdsa.PrivateKey, error) {
1849
  log.Infof("reading key from: %v", path)
1850
  key, err := newKeyFromKeystore(path, password)
1851
  if err != nil {
1852
+ return bind.TransactOpts{}, nil, err
1853
  }
1854
  if key == nil {
1855
+ return bind.TransactOpts{}, nil, nil
1856
  }
1857
  auth, err := bind.NewKeyedTransactorWithChainID(key.PrivateKey, new(big.Int).SetUint64(chainID))
1858
  if err != nil {
1859
+ return bind.TransactOpts{}, nil, err
1860
  }
1861
+ return *auth, key.PrivateKey, nil
1862
  }
1863
 
1864
  // getAuthByAddress tries to get an authorization from the authorizations map
 
1886
 
1887
  return *auth, nil
1888
  }
1889
+
1890
+ // GetDAProtocolAddr returns the address of the data availability protocol
1891
+ func (etherMan *Client) GetDAProtocolAddr() (common.Address, error) {
1892
+ return etherMan.ZkEVM.DataAvailabilityProtocol(&bind.CallOpts{Pending: false})
1893
+ }
1894
+
1895
+ // GetDAProtocolName returns the name of the data availability protocol
1896
+ func (etherMan *Client) GetDAProtocolName() (string, error) {
1897
+ return etherMan.DAProtocol.GetProcotolName(&bind.CallOpts{Pending: false})
1898
+ }
1899
+
1900
+ // SetDataAvailabilityProtocol sets the address for the new data availability protocol
1901
+ func (etherMan *Client) SetDataAvailabilityProtocol(from, daAddress common.Address) (*types.Transaction, error) {
1902
+ auth, err := etherMan.getAuthByAddress(from)
1903
+ if err != nil {
1904
+ return nil, err
1905
+ }
1906
+
1907
+ return etherMan.ZkEVM.SetDataAvailabilityProtocol(&auth, daAddress)
1908
+ }
1909
+
1910
+ // GetRollupId returns the rollup id
1911
+ func (etherMan *Client) GetRollupId() uint32 {
1912
+ return etherMan.RollupID
1913
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/etherman_test.go RENAMED
@@ -38,7 +38,7 @@
38
  }
39
 
40
  // This function prepare the blockchain, the wallet with funds and deploy the smc
41
- func newTestingEnv() (ethman *Client, ethBackend *simulated.Backend, auth *bind.TransactOpts, polAddr common.Address, br *polygonzkevmbridge.Polygonzkevmbridge) {
42
  privateKey, err := crypto.GenerateKey()
43
  if err != nil {
44
  log.Fatal(err)
@@ -47,7 +47,8 @@
47
  if err != nil {
48
  log.Fatal(err)
49
  }
50
- ethman, ethBackend, polAddr, br, err = NewSimulatedEtherman(Config{ForkIDChunkSize: 10}, auth)
 
51
  if err != nil {
52
  log.Fatal(err)
53
  }
@@ -55,12 +56,12 @@
55
  if err != nil {
56
  log.Fatal(err)
57
  }
58
- return ethman, ethBackend, auth, polAddr, br
59
  }
60
 
61
  func TestGEREvent(t *testing.T) {
62
  // Set up testing environment
63
- etherman, ethBackend, auth, _, br := newTestingEnv()
64
 
65
  // Read currentBlock
66
  ctx := context.Background()
@@ -82,14 +83,14 @@
82
  blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber)
83
  require.NoError(t, err)
84
  t.Logf("Blocks: %+v", blocks)
85
- assert.Equal(t, uint64(8), blocks[0].L1InfoTree[0].BlockNumber)
86
  assert.NotEqual(t, common.Hash{}, blocks[0].L1InfoTree[0].MainnetExitRoot)
87
  assert.Equal(t, common.Hash{}, blocks[0].L1InfoTree[0].RollupExitRoot)
88
  }
89
 
90
  func TestForcedBatchEvent(t *testing.T) {
91
  // Set up testing environment
92
- etherman, ethBackend, auth, _, _ := newTestingEnv()
93
 
94
  // Read currentBlock
95
  ctx := context.Background()
@@ -114,8 +115,8 @@
114
  blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber)
115
  require.NoError(t, err)
116
  t.Logf("Blocks: %+v", blocks)
117
- assert.Equal(t, uint64(8), blocks[0].BlockNumber)
118
- assert.Equal(t, uint64(8), blocks[0].ForcedBatches[0].BlockNumber)
119
  assert.NotEqual(t, common.Hash{}, blocks[0].ForcedBatches[0].GlobalExitRoot)
120
  assert.NotEqual(t, time.Time{}, blocks[0].ForcedBatches[0].ForcedAt)
121
  assert.Equal(t, uint64(1), blocks[0].ForcedBatches[0].ForcedBatchNumber)
@@ -125,7 +126,7 @@
125
 
126
  func TestSequencedBatchesEvent(t *testing.T) {
127
  // Set up testing environment
128
- etherman, ethBackend, auth, _, br := newTestingEnv()
129
 
130
  // Read currentBlock
131
  ctx := context.Background()
@@ -156,13 +157,16 @@
156
  blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &currentBlockNumber)
157
  require.NoError(t, err)
158
  t.Log("Blocks: ", blocks)
159
- var sequences []polygonzkevm.PolygonRollupBaseEtrogBatchData
160
- sequences = append(sequences, polygonzkevm.PolygonRollupBaseEtrogBatchData{
161
- Transactions: common.Hex2Bytes(rawTxs),
162
- }, polygonzkevm.PolygonRollupBaseEtrogBatchData{
163
- Transactions: common.Hex2Bytes(rawTxs),
 
164
  })
165
- _, err = etherman.ZkEVM.SequenceBatches(auth, sequences, uint64(time.Now().Unix()), uint64(1), auth.From)
 
 
166
  require.NoError(t, err)
167
 
168
  // Mine the tx in a block
@@ -188,7 +192,7 @@
188
 
189
  func TestVerifyBatchEvent(t *testing.T) {
190
  // Set up testing environment
191
- etherman, ethBackend, auth, _, _ := newTestingEnv()
192
 
193
  // Read currentBlock
194
  ctx := context.Background()
@@ -197,12 +201,12 @@
197
  require.NoError(t, err)
198
 
199
  rawTxs := "f84901843b9aca00827b0c945fbdb2315678afecb367f032d93f642f64180aa380a46057361d00000000000000000000000000000000000000000000000000000000000000048203e9808073efe1fa2d3e27f26f32208550ea9b0274d49050b816cadab05a771f4275d0242fd5d92b3fb89575c070e6c930587c520ee65a3aa8cfe382fcad20421bf51d621c"
200
- tx := polygonzkevm.PolygonRollupBaseEtrogBatchData{
201
- Transactions: common.Hex2Bytes(rawTxs),
202
  }
203
- //TODO: Fix params
204
- _, err = etherman.ZkEVM.SequenceBatches(auth, []polygonzkevm.PolygonRollupBaseEtrogBatchData{tx}, uint64(time.Now().Unix()), uint64(1), auth.From)
205
  require.NoError(t, err)
 
206
 
207
  // Mine the tx in a block
208
  ethBackend.Commit()
@@ -220,7 +224,7 @@
220
  blocks, order, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber)
221
  require.NoError(t, err)
222
  t.Logf("Blocks: %+v, \nOrder: %+v", blocks, order)
223
- assert.Equal(t, uint64(9), blocks[1].BlockNumber)
224
  assert.Equal(t, uint64(1), blocks[1].VerifiedBatches[0].BatchNumber)
225
  assert.NotEqual(t, common.Address{}, blocks[1].VerifiedBatches[0].Aggregator)
226
  assert.NotEqual(t, common.Hash{}, blocks[1].VerifiedBatches[0].TxHash)
@@ -232,7 +236,7 @@
232
 
233
  func TestSequenceForceBatchesEvent(t *testing.T) {
234
  // Set up testing environment
235
- etherman, ethBackend, auth, _, _ := newTestingEnv()
236
 
237
  // Read currentBlock
238
  ctx := context.Background()
@@ -283,7 +287,7 @@
283
  blocks, order, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber)
284
  require.NoError(t, err)
285
  t.Logf("Blocks: %+v", blocks)
286
- assert.Equal(t, uint64(12), blocks[1].BlockNumber)
287
  assert.Equal(t, uint64(2), blocks[1].SequencedForceBatches[0][0].BatchNumber)
288
  assert.Equal(t, forcedGer, common.BytesToHash(blocks[1].SequencedForceBatches[0][0].ForcedGlobalExitRoot[:]))
289
  assert.Equal(t, forcedTimestamp, blocks[1].SequencedForceBatches[0][0].ForcedTimestamp)
@@ -293,7 +297,7 @@
293
 
294
  func TestSendSequences(t *testing.T) {
295
  // Set up testing environment
296
- etherman, ethBackend, auth, _, br := newTestingEnv()
297
 
298
  // Read currentBlock
299
  ctx := context.Background()
@@ -315,10 +319,9 @@
315
  BatchL2Data: batchL2Data,
316
  LastL2BLockTimestamp: time.Now().Unix(),
317
  }
318
- lastL2BlockTStamp := tx1.Time().Unix()
319
- // TODO: fix params
320
- tx, err := etherman.sequenceBatches(*auth, []ethmanTypes.Sequence{sequence}, uint64(lastL2BlockTStamp), uint64(1), auth.From)
321
  require.NoError(t, err)
 
322
  log.Debug("TX: ", tx.Hash())
323
  ethBackend.Commit()
324
 
@@ -341,7 +344,7 @@
341
 
342
  func TestGasPrice(t *testing.T) {
343
  // Set up testing environment
344
- etherman, _, _, _, _ := newTestingEnv()
345
  etherscanM := new(etherscanMock)
346
  ethGasStationM := new(ethGasStationMock)
347
  etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM}
@@ -360,14 +363,14 @@
360
 
361
  func TestErrorEthGasStationPrice(t *testing.T) {
362
  // Set up testing environment
363
- etherman, _, _, _, _ := newTestingEnv()
364
  ethGasStationM := new(ethGasStationMock)
365
  etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, ethGasStationM}
366
  ctx := context.Background()
367
 
368
  ethGasStationM.On("SuggestGasPrice", ctx).Return(big.NewInt(0), fmt.Errorf("error getting gasPrice from ethGasStation"))
369
  gp := etherman.GetL1GasPrice(ctx)
370
- assert.Equal(t, big.NewInt(1392695906), gp)
371
 
372
  etherscanM := new(etherscanMock)
373
  etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM}
@@ -379,7 +382,7 @@
379
 
380
  func TestErrorEtherScanPrice(t *testing.T) {
381
  // Set up testing environment
382
- etherman, _, _, _, _ := newTestingEnv()
383
  etherscanM := new(etherscanMock)
384
  ethGasStationM := new(ethGasStationMock)
385
  etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM}
@@ -393,7 +396,7 @@
393
 
394
  func TestGetForks(t *testing.T) {
395
  // Set up testing environment
396
- etherman, _, _, _, _ := newTestingEnv()
397
  ctx := context.Background()
398
  forks, err := etherman.GetForks(ctx, 0, 132)
399
  require.NoError(t, err)
 
38
  }
39
 
40
  // This function prepare the blockchain, the wallet with funds and deploy the smc
41
+ func newTestingEnv(t *testing.T) (ethman *Client, ethBackend *simulated.Backend, auth *bind.TransactOpts, polAddr common.Address, br *polygonzkevmbridge.Polygonzkevmbridge, da *daMock) {
42
  privateKey, err := crypto.GenerateKey()
43
  if err != nil {
44
  log.Fatal(err)
 
47
  if err != nil {
48
  log.Fatal(err)
49
  }
50
+ da = newDaMock(t)
51
+ ethman, ethBackend, polAddr, br, err = NewSimulatedEtherman(Config{ForkIDChunkSize: 10}, auth, da)
52
  if err != nil {
53
  log.Fatal(err)
54
  }
 
56
  if err != nil {
57
  log.Fatal(err)
58
  }
59
+ return ethman, ethBackend, auth, polAddr, br, da
60
  }
61
 
62
  func TestGEREvent(t *testing.T) {
63
  // Set up testing environment
64
+ etherman, ethBackend, auth, _, br, _ := newTestingEnv(t)
65
 
66
  // Read currentBlock
67
  ctx := context.Background()
 
83
  blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber)
84
  require.NoError(t, err)
85
  t.Logf("Blocks: %+v", blocks)
86
+ assert.Equal(t, uint64(11), blocks[0].L1InfoTree[0].BlockNumber)
87
  assert.NotEqual(t, common.Hash{}, blocks[0].L1InfoTree[0].MainnetExitRoot)
88
  assert.Equal(t, common.Hash{}, blocks[0].L1InfoTree[0].RollupExitRoot)
89
  }
90
 
91
  func TestForcedBatchEvent(t *testing.T) {
92
  // Set up testing environment
93
+ etherman, ethBackend, auth, _, _, _ := newTestingEnv(t)
94
 
95
  // Read currentBlock
96
  ctx := context.Background()
 
115
  blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber)
116
  require.NoError(t, err)
117
  t.Logf("Blocks: %+v", blocks)
118
+ assert.Equal(t, uint64(11), blocks[0].BlockNumber)
119
+ assert.Equal(t, uint64(11), blocks[0].ForcedBatches[0].BlockNumber)
120
  assert.NotEqual(t, common.Hash{}, blocks[0].ForcedBatches[0].GlobalExitRoot)
121
  assert.NotEqual(t, time.Time{}, blocks[0].ForcedBatches[0].ForcedAt)
122
  assert.Equal(t, uint64(1), blocks[0].ForcedBatches[0].ForcedBatchNumber)
 
126
 
127
  func TestSequencedBatchesEvent(t *testing.T) {
128
  // Set up testing environment
129
+ etherman, ethBackend, auth, _, br, da := newTestingEnv(t)
130
 
131
  // Read currentBlock
132
  ctx := context.Background()
 
157
  blocks, _, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &currentBlockNumber)
158
  require.NoError(t, err)
159
  t.Log("Blocks: ", blocks)
160
+ var sequences []polygonzkevm.PolygonValidiumEtrogValidiumBatchData
161
+ txsHash := crypto.Keccak256Hash(common.Hex2Bytes(rawTxs))
162
+ sequences = append(sequences, polygonzkevm.PolygonValidiumEtrogValidiumBatchData{
163
+ TransactionsHash: txsHash,
164
+ }, polygonzkevm.PolygonValidiumEtrogValidiumBatchData{
165
+ TransactionsHash: txsHash,
166
  })
167
+ da.Mock.On("GetBatchL2Data", uint64(2), txsHash).Return(data, nil)
168
+ da.Mock.On("GetBatchL2Data", uint64(3), txsHash).Return(data, nil)
169
+ _, err = etherman.ZkEVM.SequenceBatchesValidium(auth, sequences, auth.From, []byte{})
170
  require.NoError(t, err)
171
 
172
  // Mine the tx in a block
 
192
 
193
  func TestVerifyBatchEvent(t *testing.T) {
194
  // Set up testing environment
195
+ etherman, ethBackend, auth, _, _, da := newTestingEnv(t)
196
 
197
  // Read currentBlock
198
  ctx := context.Background()
 
201
  require.NoError(t, err)
202
 
203
  rawTxs := "f84901843b9aca00827b0c945fbdb2315678afecb367f032d93f642f64180aa380a46057361d00000000000000000000000000000000000000000000000000000000000000048203e9808073efe1fa2d3e27f26f32208550ea9b0274d49050b816cadab05a771f4275d0242fd5d92b3fb89575c070e6c930587c520ee65a3aa8cfe382fcad20421bf51d621c"
204
+ tx := polygonzkevm.PolygonValidiumEtrogValidiumBatchData{
205
+ TransactionsHash: crypto.Keccak256Hash(common.Hex2Bytes(rawTxs)),
206
  }
207
+ _, err = etherman.ZkEVM.SequenceBatchesValidium(auth, []polygonzkevm.PolygonValidiumEtrogValidiumBatchData{tx}, auth.From, nil)
 
208
  require.NoError(t, err)
209
+ da.Mock.On("GetBatchL2Data", uint64(2), crypto.Keccak256Hash(common.Hex2Bytes(rawTxs))).Return(common.Hex2Bytes(rawTxs), nil)
210
 
211
  // Mine the tx in a block
212
  ethBackend.Commit()
 
224
  blocks, order, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber)
225
  require.NoError(t, err)
226
  t.Logf("Blocks: %+v, \nOrder: %+v", blocks, order)
227
+ assert.Equal(t, uint64(12), blocks[1].BlockNumber)
228
  assert.Equal(t, uint64(1), blocks[1].VerifiedBatches[0].BatchNumber)
229
  assert.NotEqual(t, common.Address{}, blocks[1].VerifiedBatches[0].Aggregator)
230
  assert.NotEqual(t, common.Hash{}, blocks[1].VerifiedBatches[0].TxHash)
 
236
 
237
  func TestSequenceForceBatchesEvent(t *testing.T) {
238
  // Set up testing environment
239
+ etherman, ethBackend, auth, _, _, _ := newTestingEnv(t)
240
 
241
  // Read currentBlock
242
  ctx := context.Background()
 
287
  blocks, order, err := etherman.GetRollupInfoByBlockRange(ctx, initBlock.NumberU64(), &finalBlockNumber)
288
  require.NoError(t, err)
289
  t.Logf("Blocks: %+v", blocks)
290
+ assert.Equal(t, uint64(15), blocks[1].BlockNumber)
291
  assert.Equal(t, uint64(2), blocks[1].SequencedForceBatches[0][0].BatchNumber)
292
  assert.Equal(t, forcedGer, common.BytesToHash(blocks[1].SequencedForceBatches[0][0].ForcedGlobalExitRoot[:]))
293
  assert.Equal(t, forcedTimestamp, blocks[1].SequencedForceBatches[0][0].ForcedTimestamp)
 
297
 
298
  func TestSendSequences(t *testing.T) {
299
  // Set up testing environment
300
+ etherman, ethBackend, auth, _, br, da := newTestingEnv(t)
301
 
302
  // Read currentBlock
303
  ctx := context.Background()
 
319
  BatchL2Data: batchL2Data,
320
  LastL2BLockTimestamp: time.Now().Unix(),
321
  }
322
+ tx, err := etherman.sequenceBatches(*auth, []ethmanTypes.Sequence{sequence}, 100, 1, auth.From, []byte{})
 
 
323
  require.NoError(t, err)
324
+ da.Mock.On("GetBatchL2Data", uint64(2), crypto.Keccak256Hash(batchL2Data)).Return(batchL2Data, nil)
325
  log.Debug("TX: ", tx.Hash())
326
  ethBackend.Commit()
327
 
 
344
 
345
  func TestGasPrice(t *testing.T) {
346
  // Set up testing environment
347
+ etherman, _, _, _, _, _ := newTestingEnv(t)
348
  etherscanM := new(etherscanMock)
349
  ethGasStationM := new(ethGasStationMock)
350
  etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM}
 
363
 
364
  func TestErrorEthGasStationPrice(t *testing.T) {
365
  // Set up testing environment
366
+ etherman, _, _, _, _, _ := newTestingEnv(t)
367
  ethGasStationM := new(ethGasStationMock)
368
  etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, ethGasStationM}
369
  ctx := context.Background()
370
 
371
  ethGasStationM.On("SuggestGasPrice", ctx).Return(big.NewInt(0), fmt.Errorf("error getting gasPrice from ethGasStation"))
372
  gp := etherman.GetL1GasPrice(ctx)
373
+ assert.Equal(t, big.NewInt(1263075579), gp)
374
 
375
  etherscanM := new(etherscanMock)
376
  etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM}
 
382
 
383
  func TestErrorEtherScanPrice(t *testing.T) {
384
  // Set up testing environment
385
+ etherman, _, _, _, _, _ := newTestingEnv(t)
386
  etherscanM := new(etherscanMock)
387
  ethGasStationM := new(ethGasStationMock)
388
  etherman.GasProviders.Providers = []ethereum.GasPricer{etherman.EthClient, etherscanM, ethGasStationM}
 
396
 
397
  func TestGetForks(t *testing.T) {
398
  // Set up testing environment
399
+ etherman, _, _, _, _, _ := newTestingEnv(t)
400
  ctx := context.Background()
401
  forks, err := etherman.GetForks(ctx, 0, 132)
402
  require.NoError(t, err)
{/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/interfaces.go RENAMED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ package etherman
2
+
3
+ import "github.com/ethereum/go-ethereum/common"
4
+
5
+ type dataAvailabilityProvider interface {
6
+ GetBatchL2Data(batchNum uint64, hash common.Hash) ([]byte, error)
7
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/etherman/simulated.go RENAMED
@@ -23,7 +24,7 @@
23
 
24
  // NewSimulatedEtherman creates an etherman that uses a simulated blockchain. It's important to notice that the ChainID of the auth
25
  // must be 1337. The address that holds the auth will have an initial balance of 10 ETH
26
- func NewSimulatedEtherman(cfg Config, auth *bind.TransactOpts) (*Client, *simulated.Backend, common.Address, *polygonzkevmbridge.Polygonzkevmbridge, error) {
27
  if auth == nil {
28
  // read only client
29
  return &Client{}, nil, common.Address{}, nil, nil
@@ -37,8 +38,26 @@
37
  },
38
  }
39
  blockGasLimit := uint64(999999999999999999) //nolint:gomnd
 
40
  client := simulated.NewBackend(genesisAlloc, simulated.WithBlockGasLimit(blockGasLimit))
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  // Deploy contracts
43
  const polDecimalPlaces = 18
44
  totalSupply, _ := new(big.Int).SetString("10000000000000000000000000000", 10) //nolint:gomnd
@@ -102,7 +121,7 @@
102
  log.Error("error: ", err)
103
  return nil, nil, common.Address{}, nil, err
104
  }
105
- br, err := polygonzkevmbridge.NewPolygonzkevmbridge(bridgeAddr, client.Client())
106
  if err != nil {
107
  log.Error("error: ", err)
108
  return nil, nil, common.Address{}, nil, err
@@ -182,6 +201,11 @@
182
  return nil, nil, common.Address{}, nil, err
183
  }
184
 
 
 
 
 
 
185
  _, err = trueZkevm.SetForceBatchAddress(auth, common.Address{})
186
  if err != nil {
187
  log.Error("error: ", err)
@@ -199,6 +223,7 @@
199
  SCAddresses: []common.Address{zkevmAddr, mockRollupManagerAddr, exitManagerAddr},
200
  auth: map[common.Address]bind.TransactOpts{},
201
  cfg: cfg,
 
202
  }
203
  err = c.AddOrReplaceAuth(*auth)
204
  if err != nil {
 
24
 
25
  // NewSimulatedEtherman creates an etherman that uses a simulated blockchain. It's important to notice that the ChainID of the auth
26
  // must be 1337. The address that holds the auth will have an initial balance of 10 ETH
27
+ func NewSimulatedEtherman(cfg Config, auth *bind.TransactOpts, daBackend dataAvailabilityProvider) (etherman *Client, ethBackend *simulated.Backend, polAddr common.Address, br *polygonzkevmbridge.Polygonzkevmbridge, err error) {
28
  if auth == nil {
29
  // read only client
30
  return &Client{}, nil, common.Address{}, nil, nil
 
38
  },
39
  }
40
  blockGasLimit := uint64(999999999999999999) //nolint:gomnd
41
+ // client := simulated.NewBackend(genesisAlloc, simulated.WithBlockGasLimit(blockGasLimit))
42
  client := simulated.NewBackend(genesisAlloc, simulated.WithBlockGasLimit(blockGasLimit))
43
 
44
+ // DAC Setup
45
+ daAddr, _, da, err := polygondatacommittee.DeployPolygondatacommittee(auth, client.Client())
46
+ if err != nil {
47
+ return nil, nil, common.Address{}, nil, err
48
+ }
49
+ client.Commit()
50
+ _, err = da.Initialize(auth)
51
+ if err != nil {
52
+ return nil, nil, common.Address{}, nil, err
53
+ }
54
+ client.Commit()
55
+ _, err = da.SetupCommittee(auth, big.NewInt(0), []string{}, []byte{})
56
+ if err != nil {
57
+ return nil, nil, common.Address{}, nil, err
58
+ }
59
+ client.Commit()
60
+
61
  // Deploy contracts
62
  const polDecimalPlaces = 18
63
  totalSupply, _ := new(big.Int).SetString("10000000000000000000000000000", 10) //nolint:gomnd
 
121
  log.Error("error: ", err)
122
  return nil, nil, common.Address{}, nil, err
123
  }
124
+ br, err = polygonzkevmbridge.NewPolygonzkevmbridge(bridgeAddr, client.Client())
125
  if err != nil {
126
  log.Error("error: ", err)
127
  return nil, nil, common.Address{}, nil, err
 
201
  return nil, nil, common.Address{}, nil, err
202
  }
203
 
204
+ _, err = trueZkevm.SetDataAvailabilityProtocol(auth, daAddr)
205
+ if err != nil {
206
+ log.Error("error: ", err)
207
+ return nil, nil, common.Address{}, nil, err
208
+ }
209
  _, err = trueZkevm.SetForceBatchAddress(auth, common.Address{})
210
  if err != nil {
211
  log.Error("error: ", err)
 
223
  SCAddresses: []common.Address{zkevmAddr, mockRollupManagerAddr, exitManagerAddr},
224
  auth: map[common.Address]bind.TransactOpts{},
225
  cfg: cfg,
226
+ da: daBackend,
227
  }
228
  err = c.AddOrReplaceAuth(*auth)
229
  if err != nil {
{/home/stefan/go/src/Polygon/zkevm-node → .}/ethtxmanager/ethtxmanager.go RENAMED
@@ -59,44 +59,15 @@
59
  return c
60
  }
61
 
62
- // getTxNonce get the nonce for the given account
63
- func (c *Client) getTxNonce(ctx context.Context, from common.Address) (uint64, error) {
64
- // Get created transactions from the database for the given account
65
- createdTxs, err := c.storage.GetBySenderAndStatus(ctx, from, []MonitoredTxStatus{MonitoredTxStatusCreated}, nil)
66
- if err != nil {
67
- return 0, fmt.Errorf("failed to get created monitored txs: %w", err)
68
- }
69
-
70
- var nonce uint64
71
- if len(createdTxs) > 0 {
72
- // if there are pending txs, we adjust the nonce accordingly
73
- for _, createdTx := range createdTxs {
74
- if createdTx.nonce > nonce {
75
- nonce = createdTx.nonce
76
- }
77
- }
78
-
79
- nonce++
80
- } else {
81
- // if there are no pending txs, we get the pending nonce from the etherman
82
- if nonce, err = c.etherman.PendingNonce(ctx, from); err != nil {
83
- return 0, fmt.Errorf("failed to get pending nonce: %w", err)
84
- }
85
- }
86
-
87
- return nonce, nil
88
- }
89
-
90
  // Add a transaction to be sent and monitored
91
  func (c *Client) Add(ctx context.Context, owner, id string, from common.Address, to *common.Address, value *big.Int, data []byte, gasOffset uint64, dbTx pgx.Tx) error {
92
- // get nonce
93
- nonce, err := c.getTxNonce(ctx, from)
94
  if err != nil {
95
- err := fmt.Errorf("failed to get nonce: %w", err)
96
  log.Errorf(err.Error())
97
  return err
98
  }
99
-
100
  // get gas
101
  gas, err := c.etherman.EstimateGas(ctx, from, to, value, data)
102
  if err != nil {
@@ -594,7 +565,7 @@
594
  // causing possible side effects and wasting resources.
595
  func (c *Client) reviewMonitoredTxNonce(ctx context.Context, mTx *monitoredTx, mTxLogger *log.Logger) error {
596
  mTxLogger.Debug("reviewing nonce")
597
- nonce, err := c.getTxNonce(ctx, mTx.from)
598
  if err != nil {
599
  err := fmt.Errorf("failed to load current nonce for acc %v: %w", mTx.from.String(), err)
600
  mTxLogger.Errorf(err.Error())
 
59
  return c
60
  }
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  // Add a transaction to be sent and monitored
63
  func (c *Client) Add(ctx context.Context, owner, id string, from common.Address, to *common.Address, value *big.Int, data []byte, gasOffset uint64, dbTx pgx.Tx) error {
64
+ // get next nonce
65
+ nonce, err := c.etherman.CurrentNonce(ctx, from)
66
  if err != nil {
67
+ err := fmt.Errorf("failed to get current nonce: %w", err)
68
  log.Errorf(err.Error())
69
  return err
70
  }
 
71
  // get gas
72
  gas, err := c.etherman.EstimateGas(ctx, from, to, value, data)
73
  if err != nil {
 
565
  // causing possible side effects and wasting resources.
566
  func (c *Client) reviewMonitoredTxNonce(ctx context.Context, mTx *monitoredTx, mTxLogger *log.Logger) error {
567
  mTxLogger.Debug("reviewing nonce")
568
+ nonce, err := c.etherman.CurrentNonce(ctx, mTx.from)
569
  if err != nil {
570
  err := fmt.Errorf("failed to load current nonce for acc %v: %w", mTx.from.String(), err)
571
  mTxLogger.Errorf(err.Error())
{/home/stefan/go/src/Polygon/zkevm-node → .}/ethtxmanager/ethtxmanager_test.go RENAMED
@@ -47,7 +47,7 @@
47
 
48
  currentNonce := uint64(1)
49
  etherman.
50
- On("PendingNonce", ctx, from).
51
  Return(currentNonce, nil).
52
  Once()
53
 
@@ -165,7 +165,7 @@
165
  // Add
166
  currentNonce := uint64(1)
167
  etherman.
168
- On("PendingNonce", ctx, from).
169
  Return(currentNonce, nil).
170
  Once()
171
 
@@ -331,7 +331,7 @@
331
  // Add
332
  currentNonce := uint64(1)
333
  etherman.
334
- On("PendingNonce", ctx, from).
335
  Return(currentNonce, nil).
336
  Once()
337
 
@@ -521,7 +521,7 @@
521
  // Add
522
  currentNonce := uint64(1)
523
  etherman.
524
- On("PendingNonce", ctx, from).
525
  Return(currentNonce, nil).
526
  Once()
527
 
@@ -593,7 +593,7 @@
593
 
594
  currentNonce = uint64(2)
595
  etherman.
596
- On("PendingNonce", ctx, from).
597
  Return(currentNonce, nil).
598
  Once()
599
  secondGasEstimation := uint64(2)
@@ -751,7 +751,7 @@
751
 
752
  currentNonce := uint64(1)
753
  etherman.
754
- On("PendingNonce", ctx, from).
755
  Return(currentNonce, nil).
756
  Once()
757
 
@@ -832,7 +832,7 @@
832
 
833
  currentNonce := uint64(1)
834
  etherman.
835
- On("PendingNonce", ctx, from).
836
  Return(currentNonce, nil).
837
  Once()
838
 
@@ -886,7 +886,7 @@
886
 
887
  currentNonce := uint64(1)
888
  etherman.
889
- On("PendingNonce", ctx, from).
890
  Return(currentNonce, nil).
891
  Once()
892
 
 
47
 
48
  currentNonce := uint64(1)
49
  etherman.
50
+ On("CurrentNonce", ctx, from).
51
  Return(currentNonce, nil).
52
  Once()
53
 
 
165
  // Add
166
  currentNonce := uint64(1)
167
  etherman.
168
+ On("CurrentNonce", ctx, from).
169
  Return(currentNonce, nil).
170
  Once()
171
 
 
331
  // Add
332
  currentNonce := uint64(1)
333
  etherman.
334
+ On("CurrentNonce", ctx, from).
335
  Return(currentNonce, nil).
336
  Once()
337
 
 
521
  // Add
522
  currentNonce := uint64(1)
523
  etherman.
524
+ On("CurrentNonce", ctx, from).
525
  Return(currentNonce, nil).
526
  Once()
527
 
 
593
 
594
  currentNonce = uint64(2)
595
  etherman.
596
+ On("CurrentNonce", ctx, from).
597
  Return(currentNonce, nil).
598
  Once()
599
  secondGasEstimation := uint64(2)
 
751
 
752
  currentNonce := uint64(1)
753
  etherman.
754
+ On("CurrentNonce", ctx, from).
755
  Return(currentNonce, nil).
756
  Once()
757
 
 
832
 
833
  currentNonce := uint64(1)
834
  etherman.
835
+ On("CurrentNonce", ctx, from).
836
  Return(currentNonce, nil).
837
  Once()
838
 
 
886
 
887
  currentNonce := uint64(1)
888
  etherman.
889
+ On("CurrentNonce", ctx, from).
890
  Return(currentNonce, nil).
891
  Once()
892
 
{/home/stefan/go/src/Polygon/zkevm-node → .}/ethtxmanager/interfaces.go RENAMED
@@ -16,7 +16,6 @@
16
  GetTxReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
17
  WaitTxToBeMined(ctx context.Context, tx *types.Transaction, timeout time.Duration) (bool, error)
18
  SendTx(ctx context.Context, tx *types.Transaction) error
19
- PendingNonce(ctx context.Context, account common.Address) (uint64, error)
20
  CurrentNonce(ctx context.Context, account common.Address) (uint64, error)
21
  SuggestedGasPrice(ctx context.Context) (*big.Int, error)
22
  EstimateGas(ctx context.Context, from common.Address, to *common.Address, value *big.Int, data []byte) (uint64, error)
@@ -29,7 +28,6 @@
29
  Add(ctx context.Context, mTx monitoredTx, dbTx pgx.Tx) error
30
  Get(ctx context.Context, owner, id string, dbTx pgx.Tx) (monitoredTx, error)
31
  GetByStatus(ctx context.Context, owner *string, statuses []MonitoredTxStatus, dbTx pgx.Tx) ([]monitoredTx, error)
32
- GetBySenderAndStatus(ctx context.Context, sender common.Address, statuses []MonitoredTxStatus, dbTx pgx.Tx) ([]monitoredTx, error)
33
  GetByBlock(ctx context.Context, fromBlock, toBlock *uint64, dbTx pgx.Tx) ([]monitoredTx, error)
34
  Update(ctx context.Context, mTx monitoredTx, dbTx pgx.Tx) error
35
  }
 
16
  GetTxReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
17
  WaitTxToBeMined(ctx context.Context, tx *types.Transaction, timeout time.Duration) (bool, error)
18
  SendTx(ctx context.Context, tx *types.Transaction) error
 
19
  CurrentNonce(ctx context.Context, account common.Address) (uint64, error)
20
  SuggestedGasPrice(ctx context.Context) (*big.Int, error)
21
  EstimateGas(ctx context.Context, from common.Address, to *common.Address, value *big.Int, data []byte) (uint64, error)
 
28
  Add(ctx context.Context, mTx monitoredTx, dbTx pgx.Tx) error
29
  Get(ctx context.Context, owner, id string, dbTx pgx.Tx) (monitoredTx, error)
30
  GetByStatus(ctx context.Context, owner *string, statuses []MonitoredTxStatus, dbTx pgx.Tx) ([]monitoredTx, error)
 
31
  GetByBlock(ctx context.Context, fromBlock, toBlock *uint64, dbTx pgx.Tx) ([]monitoredTx, error)
32
  Update(ctx context.Context, mTx monitoredTx, dbTx pgx.Tx) error
33
  }
{/home/stefan/go/src/Polygon/zkevm-node → .}/ethtxmanager/pgstorage.go RENAMED
@@ -123,50 +123,6 @@
123
  return mTxs, nil
124
  }
125
 
126
- // GetBySenderAndStatus loads all monitored txs of the given sender that match the provided status
127
- func (s *PostgresStorage) GetBySenderAndStatus(ctx context.Context, sender common.Address, statuses []MonitoredTxStatus, dbTx pgx.Tx) ([]monitoredTx, error) {
128
- hasStatusToFilter := len(statuses) > 0
129
-
130
- conn := s.dbConn(dbTx)
131
- cmd := `
132
- SELECT owner, id, from_addr, to_addr, nonce, value, data, gas, gas_offset, gas_price, status, block_num, history, created_at, updated_at
133
- FROM state.monitored_txs
134
- WHERE from_addr = $1`
135
- if hasStatusToFilter {
136
- cmd += `
137
- AND status = ANY($2)`
138
- }
139
- cmd += `
140
- ORDER BY created_at`
141
-
142
- mTxs := []monitoredTx{}
143
-
144
- var rows pgx.Rows
145
- var err error
146
- if hasStatusToFilter {
147
- rows, err = conn.Query(ctx, cmd, sender.String(), statuses)
148
- } else {
149
- rows, err = conn.Query(ctx, cmd, sender.String())
150
- }
151
-
152
- if errors.Is(err, pgx.ErrNoRows) {
153
- return []monitoredTx{}, nil
154
- } else if err != nil {
155
- return nil, err
156
- }
157
-
158
- for rows.Next() {
159
- mTx := monitoredTx{}
160
- err := s.scanMtx(rows, &mTx)
161
- if err != nil {
162
- return nil, err
163
- }
164
- mTxs = append(mTxs, mTx)
165
- }
166
-
167
- return mTxs, nil
168
- }
169
-
170
  // GetByBlock loads all monitored tx that have the blockNumber between
171
  // fromBlock and toBlock
172
  func (s *PostgresStorage) GetByBlock(ctx context.Context, fromBlock, toBlock *uint64, dbTx pgx.Tx) ([]monitoredTx, error) {
 
123
  return mTxs, nil
124
  }
125
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  // GetByBlock loads all monitored tx that have the blockNumber between
127
  // fromBlock and toBlock
128
  func (s *PostgresStorage) GetByBlock(ctx context.Context, fromBlock, toBlock *uint64, dbTx pgx.Tx) ([]monitoredTx, error) {
{/home/stefan/go/src/Polygon/zkevm-node → .}/ethtxmanager/pgstorage_test.go RENAMED
@@ -163,72 +163,6 @@
163
  assert.Equal(t, "confirmed2", mTxs[7].id)
164
  }
165
 
166
- func TestAddAndGetBySenderAndStatus(t *testing.T) {
167
- dbCfg := dbutils.NewStateConfigFromEnv()
168
- require.NoError(t, dbutils.InitOrResetState(dbCfg))
169
-
170
- storage, err := NewPostgresStorage(dbCfg)
171
- require.NoError(t, err)
172
-
173
- from := common.HexToAddress("0x1")
174
- to := common.HexToAddress("0x2")
175
- baseMtx := monitoredTx{
176
- owner: "owner", from: common.HexToAddress("0x1"), to: &to, nonce: uint64(1), value: big.NewInt(2), data: []byte("data"), blockNumber: big.NewInt(1),
177
- gas: uint64(3), gasPrice: big.NewInt(4), history: map[common.Hash]bool{common.HexToHash("0x3"): true, common.HexToHash("0x4"): true},
178
- }
179
-
180
- type mTxReplaceInfo struct {
181
- id string
182
- status MonitoredTxStatus
183
- }
184
-
185
- mTxsReplaceInfo := []mTxReplaceInfo{
186
- {id: "created1", status: MonitoredTxStatusCreated},
187
- {id: "sent1", status: MonitoredTxStatusSent},
188
- {id: "failed1", status: MonitoredTxStatusFailed},
189
- {id: "confirmed1", status: MonitoredTxStatusConfirmed},
190
- {id: "created2", status: MonitoredTxStatusCreated},
191
- {id: "sent2", status: MonitoredTxStatusSent},
192
- {id: "failed2", status: MonitoredTxStatusFailed},
193
- {id: "confirmed2", status: MonitoredTxStatusConfirmed},
194
- }
195
-
196
- for _, replaceInfo := range mTxsReplaceInfo {
197
- baseMtx.id = replaceInfo.id
198
- baseMtx.status = replaceInfo.status
199
- baseMtx.createdAt = baseMtx.createdAt.Add(time.Microsecond)
200
- baseMtx.updatedAt = baseMtx.updatedAt.Add(time.Microsecond)
201
- err = storage.Add(context.Background(), baseMtx, nil)
202
- require.NoError(t, err)
203
- }
204
-
205
- mTxs, err := storage.GetBySenderAndStatus(context.Background(), from, []MonitoredTxStatus{MonitoredTxStatusConfirmed}, nil)
206
- require.NoError(t, err)
207
- assert.Equal(t, 2, len(mTxs))
208
- assert.Equal(t, "confirmed1", mTxs[0].id)
209
- assert.Equal(t, "confirmed2", mTxs[1].id)
210
-
211
- mTxs, err = storage.GetBySenderAndStatus(context.Background(), from, []MonitoredTxStatus{MonitoredTxStatusSent, MonitoredTxStatusCreated}, nil)
212
- require.NoError(t, err)
213
- assert.Equal(t, 4, len(mTxs))
214
- assert.Equal(t, "created1", mTxs[0].id)
215
- assert.Equal(t, "sent1", mTxs[1].id)
216
- assert.Equal(t, "created2", mTxs[2].id)
217
- assert.Equal(t, "sent2", mTxs[3].id)
218
-
219
- mTxs, err = storage.GetBySenderAndStatus(context.Background(), from, []MonitoredTxStatus{}, nil)
220
- require.NoError(t, err)
221
- assert.Equal(t, 8, len(mTxs))
222
- assert.Equal(t, "created1", mTxs[0].id)
223
- assert.Equal(t, "sent1", mTxs[1].id)
224
- assert.Equal(t, "failed1", mTxs[2].id)
225
- assert.Equal(t, "confirmed1", mTxs[3].id)
226
- assert.Equal(t, "created2", mTxs[4].id)
227
- assert.Equal(t, "sent2", mTxs[5].id)
228
- assert.Equal(t, "failed2", mTxs[6].id)
229
- assert.Equal(t, "confirmed2", mTxs[7].id)
230
- }
231
-
232
  func TestAddRepeated(t *testing.T) {
233
  dbCfg := dbutils.NewStateConfigFromEnv()
234
  require.NoError(t, dbutils.InitOrResetState(dbCfg))
 
163
  assert.Equal(t, "confirmed2", mTxs[7].id)
164
  }
165
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  func TestAddRepeated(t *testing.T) {
167
  dbCfg := dbutils.NewStateConfigFromEnv()
168
  require.NoError(t, dbutils.InitOrResetState(dbCfg))
{/home/stefan/go/src/Polygon/zkevm-node → .}/event/event.go RENAMED
@@ -42,6 +42,9 @@
42
  EventID_SynchronizerHalt EventID = "SYNCHRONIZER HALT"
43
  // EventID_SequenceSenderHalt is triggered when the SequenceSender halts
44
  EventID_SequenceSenderHalt EventID = "SEQUENCESENDER HALT"
 
 
 
45
  // EventID_NodeOOC is triggered when an OOC at node level is detected
46
  EventID_NodeOOC EventID = "NODE OOC"
47
  // EventID_UsedZKCountersOverflow is triggered when used ZK counters exceeds remaining batch ZK counters
 
42
  EventID_SynchronizerHalt EventID = "SYNCHRONIZER HALT"
43
  // EventID_SequenceSenderHalt is triggered when the SequenceSender halts
44
  EventID_SequenceSenderHalt EventID = "SEQUENCESENDER HALT"
45
+ // EventID_UnsupportedPrecompile is triggered when the executor returns an unsupported precompile error
46
+ EventID_UnsupportedPrecompile EventID = "UNSUPPORTED PRECOMPILE"
47
+
48
  // EventID_NodeOOC is triggered when an OOC at node level is detected
49
  EventID_NodeOOC EventID = "NODE OOC"
50
  // EventID_UsedZKCountersOverflow is triggered when used ZK counters exceeds remaining batch ZK counters
{/home/stefan/go/src/Polygon/zkevm-node → .}/.golangci.yml RENAMED
@@ -30,3 +30,6 @@
30
  include:
31
  - EXC0012 # EXC0012 revive: Annoying issue about not having a comment. The rare codebase has such comments
32
  - EXC0014 # EXC0014 revive: Annoying issue about not having a comment. The rare codebase has such comments
 
 
 
 
30
  include:
31
  - EXC0012 # EXC0012 revive: Annoying issue about not having a comment. The rare codebase has such comments
32
  - EXC0014 # EXC0014 revive: Annoying issue about not having a comment. The rare codebase has such comments
33
+ exclude-rules:
34
+ - path: cmd/policy.go
35
+ text: "unused"
{/home/stefan/go/src/Polygon/zkevm-node → .}/go.mod RENAMED
@@ -3,34 +3,34 @@
3
  go 1.21
4
 
5
  require (
6
- github.com/0xPolygonHermez/zkevm-data-streamer v0.1.19
7
  github.com/didip/tollbooth/v6 v6.1.2
8
  github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127
9
  github.com/ethereum/go-ethereum v1.13.11
10
  github.com/go-git/go-billy/v5 v5.5.0
11
  github.com/go-git/go-git/v5 v5.11.0
12
  github.com/gobuffalo/packr/v2 v2.8.3
13
- github.com/google/uuid v1.6.0
14
  github.com/habx/pg-commands v0.6.1
15
  github.com/hermeznetwork/tracerr v0.3.2
16
- github.com/iden3/go-iden3-crypto v0.0.16
17
  github.com/invopop/jsonschema v0.12.0
18
  github.com/jackc/pgconn v1.14.1
19
  github.com/jackc/pgx/v4 v4.18.1
20
  github.com/mitchellh/mapstructure v1.5.0
21
- github.com/prometheus/client_model v0.6.0
22
- github.com/prometheus/common v0.47.0
23
  github.com/rubenv/sql-migrate v1.6.1
24
  github.com/spf13/afero v1.11.0
25
- github.com/spf13/viper v1.17.0
26
  github.com/stretchr/testify v1.8.4
27
- github.com/umbracle/ethgo v0.1.3
28
- github.com/urfave/cli/v2 v2.27.1
29
- go.uber.org/zap v1.27.0
30
- golang.org/x/crypto v0.19.0
31
- golang.org/x/net v0.21.0
32
- golang.org/x/sync v0.6.0
33
- google.golang.org/grpc v1.62.0
34
  google.golang.org/protobuf v1.32.0
35
  gopkg.in/yaml.v2 v2.4.0
36
  gopkg.in/yaml.v3 v3.0.1
@@ -45,7 +45,7 @@
45
  github.com/VictoriaMetrics/fastcache v1.12.1 // indirect
46
  github.com/bahlo/generic-list-go v0.2.0 // indirect
47
  github.com/beorn7/perks v1.0.1 // indirect
48
- github.com/bits-and-blooms/bitset v1.10.0 // indirect
49
  github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
50
  github.com/buger/jsonparser v1.1.1 // indirect
51
  github.com/cespare/xxhash/v2 v2.2.0 // indirect
@@ -63,12 +63,12 @@
63
  github.com/cyphar/filepath-securejoin v0.2.4 // indirect
64
  github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
65
  github.com/deckarep/golang-set/v2 v2.1.0 // indirect
66
- github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
67
  github.com/dlclark/regexp2 v1.7.0 // indirect
68
  github.com/emirpasic/gods v1.18.1 // indirect
69
  github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
70
  github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect
71
- github.com/fsnotify/fsnotify v1.6.0 // indirect
72
  github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
73
  github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect
74
  github.com/getsentry/sentry-go v0.18.0 // indirect
@@ -101,6 +101,7 @@
101
  github.com/jackc/puddle v1.3.0 // indirect
102
  github.com/jackpal/go-nat-pmp v1.0.2 // indirect
103
  github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
 
104
  github.com/karrick/godirwalk v1.17.0 // indirect
105
  github.com/kevinburke/ssh_config v1.2.0 // indirect
106
  github.com/klauspost/compress v1.17.0 // indirect
@@ -115,6 +116,8 @@
115
  github.com/mattn/go-colorable v0.1.13 // indirect
116
  github.com/mattn/go-isatty v0.0.20 // indirect
117
  github.com/mattn/go-runewidth v0.0.13 // indirect
 
 
118
  github.com/mitchellh/pointerstructure v1.2.0 // indirect
119
  github.com/mmcloughlin/addchain v0.4.0 // indirect
120
  github.com/olekukonko/tablewriter v0.0.5 // indirect
@@ -127,14 +130,14 @@
127
  github.com/rogpeppe/go-internal v1.11.0 // indirect
128
  github.com/rs/cors v1.7.0 // indirect
129
  github.com/russross/blackfriday/v2 v2.1.0 // indirect
130
- github.com/sagikazarmark/locafero v0.3.0 // indirect
131
  github.com/sagikazarmark/slog-shim v0.1.0 // indirect
132
  github.com/sergi/go-diff v1.2.0 // indirect
133
  github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
134
  github.com/sirupsen/logrus v1.9.0 // indirect
135
  github.com/skeema/knownhosts v1.2.1 // indirect
136
  github.com/sourcegraph/conc v0.3.0 // indirect
137
- github.com/spf13/cast v1.5.1 // indirect
138
  github.com/spf13/pflag v1.0.5 // indirect
139
  github.com/status-im/keycard-go v0.2.0 // indirect
140
  github.com/stretchr/objx v0.5.0 // indirect
@@ -150,12 +153,12 @@
150
  github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
151
  go.uber.org/multierr v1.10.0 // indirect
152
  golang.org/x/mod v0.14.0 // indirect
153
- golang.org/x/sys v0.17.0 // indirect
154
- golang.org/x/term v0.17.0 // indirect
155
  golang.org/x/text v0.14.0 // indirect
156
  golang.org/x/time v0.5.0 // indirect
157
  golang.org/x/tools v0.15.0 // indirect
158
- google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect
159
  gopkg.in/ini.v1 v1.67.0 // indirect
160
  gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
161
  gopkg.in/warnings.v0 v0.1.2 // indirect
 
3
  go 1.21
4
 
5
  require (
6
+ github.com/0xPolygonHermez/zkevm-data-streamer v0.1.18
7
  github.com/didip/tollbooth/v6 v6.1.2
8
  github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127
9
  github.com/ethereum/go-ethereum v1.13.11
10
  github.com/go-git/go-billy/v5 v5.5.0
11
  github.com/go-git/go-git/v5 v5.11.0
12
  github.com/gobuffalo/packr/v2 v2.8.3
13
+ github.com/google/uuid v1.5.0
14
  github.com/habx/pg-commands v0.6.1
15
  github.com/hermeznetwork/tracerr v0.3.2
16
+ github.com/iden3/go-iden3-crypto v0.0.15
17
  github.com/invopop/jsonschema v0.12.0
18
  github.com/jackc/pgconn v1.14.1
19
  github.com/jackc/pgx/v4 v4.18.1
20
  github.com/mitchellh/mapstructure v1.5.0
21
+ github.com/prometheus/client_model v0.5.0
22
+ github.com/prometheus/common v0.45.0
23
  github.com/rubenv/sql-migrate v1.6.1
24
  github.com/spf13/afero v1.11.0
25
+ github.com/spf13/viper v1.18.2
26
  github.com/stretchr/testify v1.8.4
27
+ github.com/umbracle/ethgo v0.1.4-0.20230712173909-df37dddf16f0
28
+ github.com/urfave/cli/v2 v2.26.0
29
+ go.uber.org/zap v1.26.0
30
+ golang.org/x/crypto v0.18.0
31
+ golang.org/x/net v0.20.0
32
+ golang.org/x/sync v0.5.0
33
+ google.golang.org/grpc v1.60.1
34
  google.golang.org/protobuf v1.32.0
35
  gopkg.in/yaml.v2 v2.4.0
36
  gopkg.in/yaml.v3 v3.0.1
 
45
  github.com/VictoriaMetrics/fastcache v1.12.1 // indirect
46
  github.com/bahlo/generic-list-go v0.2.0 // indirect
47
  github.com/beorn7/perks v1.0.1 // indirect
48
+ github.com/bits-and-blooms/bitset v1.12.0 // indirect
49
  github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
50
  github.com/buger/jsonparser v1.1.1 // indirect
51
  github.com/cespare/xxhash/v2 v2.2.0 // indirect
 
63
  github.com/cyphar/filepath-securejoin v0.2.4 // indirect
64
  github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
65
  github.com/deckarep/golang-set/v2 v2.1.0 // indirect
66
+ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
67
  github.com/dlclark/regexp2 v1.7.0 // indirect
68
  github.com/emirpasic/gods v1.18.1 // indirect
69
  github.com/ethereum/c-kzg-4844 v0.4.0 // indirect
70
  github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect
71
+ github.com/fsnotify/fsnotify v1.7.0 // indirect
72
  github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
73
  github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect
74
  github.com/getsentry/sentry-go v0.18.0 // indirect
 
101
  github.com/jackc/puddle v1.3.0 // indirect
102
  github.com/jackpal/go-nat-pmp v1.0.2 // indirect
103
  github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
104
+ github.com/jmoiron/sqlx v1.2.0 // indirect
105
  github.com/karrick/godirwalk v1.17.0 // indirect
106
  github.com/kevinburke/ssh_config v1.2.0 // indirect
107
  github.com/klauspost/compress v1.17.0 // indirect
 
116
  github.com/mattn/go-colorable v0.1.13 // indirect
117
  github.com/mattn/go-isatty v0.0.20 // indirect
118
  github.com/mattn/go-runewidth v0.0.13 // indirect
119
+ github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
120
+ github.com/miguelmota/go-solidity-sha3 v0.1.1 // indirect
121
  github.com/mitchellh/pointerstructure v1.2.0 // indirect
122
  github.com/mmcloughlin/addchain v0.4.0 // indirect
123
  github.com/olekukonko/tablewriter v0.0.5 // indirect
 
130
  github.com/rogpeppe/go-internal v1.11.0 // indirect
131
  github.com/rs/cors v1.7.0 // indirect
132
  github.com/russross/blackfriday/v2 v2.1.0 // indirect
133
+ github.com/sagikazarmark/locafero v0.4.0 // indirect
134
  github.com/sagikazarmark/slog-shim v0.1.0 // indirect
135
  github.com/sergi/go-diff v1.2.0 // indirect
136
  github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
137
  github.com/sirupsen/logrus v1.9.0 // indirect
138
  github.com/skeema/knownhosts v1.2.1 // indirect
139
  github.com/sourcegraph/conc v0.3.0 // indirect
140
+ github.com/spf13/cast v1.6.0 // indirect
141
  github.com/spf13/pflag v1.0.5 // indirect
142
  github.com/status-im/keycard-go v0.2.0 // indirect
143
  github.com/stretchr/objx v0.5.0 // indirect
 
153
  github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
154
  go.uber.org/multierr v1.10.0 // indirect
155
  golang.org/x/mod v0.14.0 // indirect
156
+ golang.org/x/sys v0.16.0 // indirect
157
+ golang.org/x/term v0.16.0 // indirect
158
  golang.org/x/text v0.14.0 // indirect
159
  golang.org/x/time v0.5.0 // indirect
160
  golang.org/x/tools v0.15.0 // indirect
161
+ google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
162
  gopkg.in/ini.v1 v1.67.0 // indirect
163
  gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
164
  gopkg.in/warnings.v0 v0.1.2 // indirect
{/home/stefan/go/src/Polygon/zkevm-node → .}/.goreleaser-cdk.yaml RENAMED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # .goreleaser-cdk.yaml
2
+ project_name: cdk-validium-node
3
+
4
+ release:
5
+ disable: false
6
+ draft: true
7
+ prerelease: auto
8
+
9
+ builds:
10
+ - main: ./cmd/
11
+ binary: zkevm-node
12
+ goos:
13
+ - linux
14
+ - darwin
15
+ goarch:
16
+ - amd64
17
+ - arm64
18
+ env:
19
+ - CGO_ENABLED=0
20
+ ldflags:
21
+ - -s -w
22
+ - -X github.com/0xPolygon/{{ .ProjectName }}.Version={{ .Version }}
23
+ - -X github.com/0xPolygon/{{ .ProjectName }}.GitRev={{ .Commit }}
24
+ - -X github.com/0xPolygon/{{ .ProjectName }}.BuildDate={{ .Date }}
25
+ - -X github.com/0xPolygon/{{ .ProjectName }}.GitBranch={{ .Branch }}
26
+
27
+ archives:
28
+ - files:
29
+ - LICENSE
30
+ - README.md
31
+
32
+ dockers:
33
+ - image_templates:
34
+ - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-amd64
35
+ dockerfile: Dockerfile.release
36
+ use: buildx
37
+ goos: linux
38
+ goarch: amd64
39
+ build_flag_templates:
40
+ - --platform=linux/amd64
41
+ - --label=org.opencontainers.image.title={{ .ProjectName }}
42
+ - --label=org.opencontainers.image.description={{ .ProjectName }}
43
+ - --label=org.opencontainers.image.url=https://github.com/{{ .ProjectName }}
44
+ - --label=org.opencontainers.image.source=https://github.com/{{ .ProjectName }}
45
+ - --label=org.opencontainers.image.version={{ .Version }}
46
+ - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
47
+ - --label=org.opencontainers.image.revision={{ .FullCommit }}
48
+ skip_push: false
49
+
50
+ - image_templates:
51
+ - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-arm64
52
+ dockerfile: Dockerfile.release
53
+ use: buildx
54
+ goos: linux
55
+ goarch: arm64
56
+ build_flag_templates:
57
+ - --platform=linux/arm64
58
+ - --label=org.opencontainers.image.title={{ .ProjectName }}
59
+ - --label=org.opencontainers.image.description={{ .ProjectName }}
60
+ - --label=org.opencontainers.image.url=https://github.com/{{ .ProjectName }}
61
+ - --label=org.opencontainers.image.source=https://github.com/{{ .ProjectName }}
62
+ - --label=org.opencontainers.image.version={{ .Version }}
63
+ - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
64
+ - --label=org.opencontainers.image.revision={{ .FullCommit }}
65
+ skip_push: false
66
+
67
+ docker_manifests:
68
+ - name_template: 0xpolygon/{{ .ProjectName }}:{{ .Version }}
69
+ image_templates:
70
+ - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-amd64
71
+ - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-arm64
72
+ skip_push: false
73
+
74
+ - name_template: 0xpolygon/{{ .ProjectName }}:latest
75
+ image_templates:
76
+ - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-amd64
77
+ - 0xpolygon/{{ .ProjectName }}:{{ replace .Version "+" "-" }}-arm64
78
+ skip_push: false
{/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/client/zkevm_test.go RENAMED
@@ -1,25 +0,0 @@
1
- package client
2
-
3
- import (
4
- "context"
5
- "fmt"
6
- "math/big"
7
- "testing"
8
-
9
- "github.com/0xPolygonHermez/zkevm-node/log"
10
- "github.com/stretchr/testify/require"
11
- )
12
-
13
- func TestZkevmGetBatch(t *testing.T) {
14
- t.Skip("This test is exploratory")
15
- // Create a new client
16
- client := NewClient("https://zkevm-rpc.com/")
17
- lastTrustedStateBatchNumberSeen, err := client.BatchNumber(context.Background())
18
- require.NoError(t, err)
19
- log.Info("lastTrustedStateBatchNumberSeen: ", lastTrustedStateBatchNumberSeen)
20
- batch, err := client.BatchByNumber(context.Background(), big.NewInt(int64(lastTrustedStateBatchNumberSeen)))
21
- require.NoError(t, err)
22
-
23
- // Print the batch
24
- fmt.Println(batch)
25
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
{/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/endpoints_eth.go RENAMED
@@ -941,6 +941,9 @@
941
  if e.cfg.SequencerNodeURI != "" {
942
  return e.relayTxToSequencerNode(input)
943
  } else {
 
 
 
944
  ip := ""
945
  ips := httpRequest.Header.Get("X-Forwarded-For")
946
 
 
941
  if e.cfg.SequencerNodeURI != "" {
942
  return e.relayTxToSequencerNode(input)
943
  } else {
944
+ if err := checkPolicy(context.Background(), e.pool, input); err != nil {
945
+ return RPCErrorResponse(types.AccessDeniedCode, err.Error(), nil, false)
946
+ }
947
  ip := ""
948
  ips := httpRequest.Header.Get("X-Forwarded-For")
949
 
{/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/endpoints_eth_test.go RENAMED
@@ -6,6 +6,7 @@
6
  "errors"
7
  "fmt"
8
  "math/big"
 
9
  "sync"
10
  "testing"
11
  "time"
@@ -5416,3 +5417,237 @@
5416
  assert.ElementsMatch(t, []int{13, 14, 15}, results[4])
5417
  assert.ElementsMatch(t, []int{16}, results[5])
5418
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
  "errors"
7
  "fmt"
8
  "math/big"
9
+ "strings"
10
  "sync"
11
  "testing"
12
  "time"
 
5417
  assert.ElementsMatch(t, []int{13, 14, 15}, results[4])
5418
  assert.ElementsMatch(t, []int{16}, results[5])
5419
  }
5420
+
5421
+ func TestSendRawTransactionJSONRPCCallWithPolicyApplied(t *testing.T) {
5422
+ // Set up the sender
5423
+ allowedPrivateKey, err := crypto.HexToECDSA(strings.TrimPrefix("0x28b2b0318721be8c8339199172cd7cc8f5e273800a35616ec893083a4b32c02e", "0x"))
5424
+ require.NoError(t, err)
5425
+ allowed, err := bind.NewKeyedTransactorWithChainID(allowedPrivateKey, big.NewInt(1))
5426
+ require.NoError(t, err)
5427
+
5428
+ disallowedPrivateKey, err := crypto.HexToECDSA(strings.TrimPrefix("0xdeadbeef8721be8c8339199172cd7cc8f5e273800a35616ec893083a4b32c02e", "0x"))
5429
+ require.NoError(t, err)
5430
+ disallowed, err := bind.NewKeyedTransactorWithChainID(disallowedPrivateKey, big.NewInt(1))
5431
+ require.NoError(t, err)
5432
+ require.NotNil(t, disallowed)
5433
+
5434
+ allowedContract := common.HexToAddress("0x1")
5435
+ disallowedContract := common.HexToAddress("0x2")
5436
+
5437
+ senderDenied := types.NewRPCError(types.AccessDeniedCode, "sender disallowed send_tx by policy")
5438
+ contractDenied := types.NewRPCError(types.AccessDeniedCode, "contract disallowed send_tx by policy")
5439
+ deployDenied := types.NewRPCError(types.AccessDeniedCode, "sender disallowed deploy by policy")
5440
+
5441
+ cfg := getSequencerDefaultConfig()
5442
+ s, m, _ := newMockedServerWithCustomConfig(t, cfg)
5443
+ defer s.Stop()
5444
+
5445
+ type testCase struct {
5446
+ Name string
5447
+ Input string
5448
+ ExpectedResult *common.Hash
5449
+ ExpectedError types.Error
5450
+ Prepare func(t *testing.T, tc *testCase)
5451
+ SetupMocks func(t *testing.T, m *mocksWrapper, tc testCase)
5452
+ }
5453
+
5454
+ testCases := []testCase{
5455
+ {
5456
+ Name: "Sender & contract on allow list, accepted",
5457
+ Prepare: func(t *testing.T, tc *testCase) {
5458
+ tx := ethTypes.NewTransaction(1, allowedContract, big.NewInt(1), uint64(1), big.NewInt(1), []byte{})
5459
+
5460
+ signedTx, err := allowed.Signer(allowed.From, tx)
5461
+ require.NoError(t, err)
5462
+
5463
+ txBinary, err := signedTx.MarshalBinary()
5464
+ require.NoError(t, err)
5465
+
5466
+ rawTx := hex.EncodeToHex(txBinary)
5467
+ require.NoError(t, err)
5468
+
5469
+ tc.Input = rawTx
5470
+ expectedHash := signedTx.Hash()
5471
+ tc.ExpectedResult = &expectedHash
5472
+ tc.ExpectedError = nil
5473
+ },
5474
+ SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) {
5475
+ m.Pool.
5476
+ On("AddTx", context.Background(), mock.IsType(ethTypes.Transaction{}), "").
5477
+ Return(nil).
5478
+ Once()
5479
+ m.Pool.
5480
+ On("CheckPolicy", context.Background(), pool.SendTx, allowedContract).
5481
+ Return(true, nil).
5482
+ Once()
5483
+ m.Pool.
5484
+ On("CheckPolicy", context.Background(), pool.SendTx, allowed.From).
5485
+ Return(true, nil).
5486
+ Once()
5487
+ },
5488
+ },
5489
+ {
5490
+ Name: "Contract not on allow list, rejected",
5491
+ Prepare: func(t *testing.T, tc *testCase) {
5492
+ tx := ethTypes.NewTransaction(1, disallowedContract, big.NewInt(1), uint64(1), big.NewInt(1), []byte{})
5493
+
5494
+ signedTx, err := allowed.Signer(allowed.From, tx)
5495
+ require.NoError(t, err)
5496
+
5497
+ txBinary, err := signedTx.MarshalBinary()
5498
+ require.NoError(t, err)
5499
+
5500
+ rawTx := hex.EncodeToHex(txBinary)
5501
+ require.NoError(t, err)
5502
+
5503
+ tc.Input = rawTx
5504
+ tc.ExpectedResult = nil
5505
+ tc.ExpectedError = contractDenied
5506
+ },
5507
+ SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) {
5508
+ m.Pool.
5509
+ On("CheckPolicy", context.Background(), pool.SendTx, disallowedContract).
5510
+ Return(false, contractDenied).
5511
+ Once()
5512
+ },
5513
+ },
5514
+ {
5515
+ Name: "Sender not on allow list, rejected",
5516
+ Prepare: func(t *testing.T, tc *testCase) {
5517
+ tx := ethTypes.NewTransaction(1, allowedContract, big.NewInt(1), uint64(1), big.NewInt(1), []byte{})
5518
+
5519
+ signedTx, err := disallowed.Signer(disallowed.From, tx)
5520
+ require.NoError(t, err)
5521
+
5522
+ txBinary, err := signedTx.MarshalBinary()
5523
+ require.NoError(t, err)
5524
+
5525
+ rawTx := hex.EncodeToHex(txBinary)
5526
+ require.NoError(t, err)
5527
+
5528
+ tc.Input = rawTx
5529
+ tc.ExpectedResult = nil
5530
+ tc.ExpectedError = senderDenied
5531
+ },
5532
+ SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) {
5533
+ m.Pool.
5534
+ On("CheckPolicy", context.Background(), pool.SendTx, allowedContract).
5535
+ Return(true, nil).
5536
+ Once()
5537
+ m.Pool.
5538
+ On("CheckPolicy", context.Background(), pool.SendTx, disallowed.From).
5539
+ Return(false, senderDenied).
5540
+ Once()
5541
+ },
5542
+ },
5543
+ {
5544
+ Name: "Unsigned tx with allowed contract, accepted", // for backward compatibility
5545
+ Prepare: func(t *testing.T, tc *testCase) {
5546
+ tx := ethTypes.NewTransaction(1, allowedContract, big.NewInt(1), uint64(1), big.NewInt(1), []byte{})
5547
+
5548
+ txBinary, err := tx.MarshalBinary()
5549
+ require.NoError(t, err)
5550
+
5551
+ rawTx := hex.EncodeToHex(txBinary)
5552
+ require.NoError(t, err)
5553
+
5554
+ tc.Input = rawTx
5555
+ expectedHash := tx.Hash()
5556
+ tc.ExpectedResult = &expectedHash
5557
+ tc.ExpectedError = nil
5558
+ },
5559
+ SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) {
5560
+ m.Pool.
5561
+ On("AddTx", context.Background(), mock.IsType(ethTypes.Transaction{}), "").
5562
+ Return(nil).
5563
+ Once()
5564
+ // policy does not reject this case for backward compat
5565
+ },
5566
+ },
5567
+ {
5568
+ Name: "Unsigned tx with disallowed contract, rejected",
5569
+ Prepare: func(t *testing.T, tc *testCase) {
5570
+ tx := ethTypes.NewTransaction(1, disallowedContract, big.NewInt(1), uint64(1), big.NewInt(1), []byte{})
5571
+
5572
+ signedTx, err := disallowed.Signer(disallowed.From, tx)
5573
+ require.NoError(t, err)
5574
+
5575
+ txBinary, err := signedTx.MarshalBinary()
5576
+ require.NoError(t, err)
5577
+
5578
+ rawTx := hex.EncodeToHex(txBinary)
5579
+ require.NoError(t, err)
5580
+
5581
+ tc.Input = rawTx
5582
+ tc.ExpectedResult = nil
5583
+ tc.ExpectedError = contractDenied
5584
+ },
5585
+ SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) {
5586
+ m.Pool.
5587
+ On("CheckPolicy", context.Background(), pool.SendTx, disallowedContract).
5588
+ Return(false, contractDenied).
5589
+ Once()
5590
+ },
5591
+ },
5592
+ {
5593
+ Name: "Send invalid tx input", // for backward compatibility
5594
+ Prepare: func(t *testing.T, tc *testCase) {
5595
+ tc.Input = "0x1234"
5596
+ tc.ExpectedResult = nil
5597
+ tc.ExpectedError = types.NewRPCError(types.InvalidParamsErrorCode, "invalid tx input")
5598
+ },
5599
+ SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) {},
5600
+ },
5601
+ {
5602
+ Name: "Sender not on deploy allow list, rejected",
5603
+ Prepare: func(t *testing.T, tc *testCase) {
5604
+ deployAddr := common.HexToAddress("0x0")
5605
+ tx := ethTypes.NewTransaction(1, deployAddr, big.NewInt(1), uint64(1), big.NewInt(1), []byte{})
5606
+
5607
+ signedTx, err := disallowed.Signer(disallowed.From, tx)
5608
+ require.NoError(t, err)
5609
+
5610
+ txBinary, err := signedTx.MarshalBinary()
5611
+ require.NoError(t, err)
5612
+
5613
+ rawTx := hex.EncodeToHex(txBinary)
5614
+ require.NoError(t, err)
5615
+
5616
+ tc.Input = rawTx
5617
+ tc.ExpectedResult = nil
5618
+ tc.ExpectedError = deployDenied
5619
+ },
5620
+ SetupMocks: func(t *testing.T, m *mocksWrapper, tc testCase) {
5621
+ m.Pool.
5622
+ On("CheckPolicy", context.Background(), pool.Deploy, disallowed.From).
5623
+ Return(false, nil).
5624
+ Once()
5625
+ },
5626
+ },
5627
+ }
5628
+
5629
+ for _, testCase := range testCases {
5630
+ t.Run(testCase.Name, func(t *testing.T) {
5631
+ tc := testCase
5632
+ tc.Prepare(t, &tc)
5633
+ tc.SetupMocks(t, m, tc)
5634
+
5635
+ res, err := s.JSONRPCCall("eth_sendRawTransaction", tc.Input)
5636
+ require.NoError(t, err)
5637
+
5638
+ assert.Equal(t, float64(1), res.ID)
5639
+ assert.Equal(t, "2.0", res.JSONRPC)
5640
+
5641
+ if res.Result != nil || tc.ExpectedResult != nil {
5642
+ var result common.Hash
5643
+ err = json.Unmarshal(res.Result, &result)
5644
+ require.NoError(t, err)
5645
+ assert.Equal(t, *tc.ExpectedResult, result)
5646
+ }
5647
+ if res.Error != nil || tc.ExpectedError != nil {
5648
+ assert.Equal(t, tc.ExpectedError.ErrorCode(), res.Error.Code)
5649
+ assert.Equal(t, tc.ExpectedError.Error(), res.Error.Message)
5650
+ }
5651
+ })
5652
+ }
5653
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/policy.go RENAMED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package jsonrpc
2
+
3
+ import (
4
+ "context"
5
+
6
+ "github.com/0xPolygonHermez/zkevm-node/jsonrpc/types"
7
+ "github.com/0xPolygonHermez/zkevm-node/pool"
8
+ "github.com/0xPolygonHermez/zkevm-node/state"
9
+ "github.com/ethereum/go-ethereum/common"
10
+ ethTypes "github.com/ethereum/go-ethereum/core/types"
11
+ )
12
+
13
+ func checkPolicy(ctx context.Context, p types.PoolInterface, input string) error {
14
+ tx, err := hexToTx(input)
15
+ if err != nil {
16
+ // ignore it, let the later processing reject
17
+ return nil
18
+ }
19
+
20
+ // if the tx is signed, check the from address. If there is no from address, the tx is not rejected as it
21
+ // will get rejected later. This maintains backward compatibility with RPC expectations. TODO: verify this is ok behavior
22
+ var from common.Address
23
+ if from, err = state.GetSender(*tx); err != nil {
24
+ // if not signed, then skip check, it fails later on its own
25
+ return nil
26
+ }
27
+
28
+ switch resolvePolicy(tx) {
29
+ case pool.SendTx:
30
+ var allow bool
31
+ if allow, err = p.CheckPolicy(ctx, pool.SendTx, *tx.To()); err != nil {
32
+ return err
33
+ }
34
+ if !allow {
35
+ return pool.ErrContractDisallowedSendTx
36
+ }
37
+ if allow, err = p.CheckPolicy(ctx, pool.SendTx, from); err != nil {
38
+ return err
39
+ }
40
+ if !allow {
41
+ return pool.ErrSenderDisallowedSendTx
42
+ }
43
+ case pool.Deploy:
44
+ var allow bool
45
+ // check that sender may deploy contracts
46
+ if allow, err = p.CheckPolicy(ctx, pool.Deploy, from); err != nil {
47
+ return err
48
+ }
49
+ if !allow {
50
+ return pool.ErrSenderDisallowedDeploy
51
+ }
52
+ }
53
+ return nil
54
+ }
55
+
56
+ func resolvePolicy(tx *ethTypes.Transaction) pool.PolicyName {
57
+ if tx.To() == nil || tx.To().Hex() == common.HexToAddress("0x0").Hex() {
58
+ return pool.Deploy
59
+ }
60
+ return pool.SendTx
61
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/types/errors.go RENAMED
@@ -15,6 +15,8 @@
15
  InvalidParamsErrorCode = -32602
16
  // ParserErrorCode error code for parsing errors
17
  ParserErrorCode = -32700
 
 
18
  )
19
 
20
  var (
 
15
  InvalidParamsErrorCode = -32602
16
  // ParserErrorCode error code for parsing errors
17
  ParserErrorCode = -32700
18
+ // AccessDeniedCode error code when requests are denied
19
+ AccessDeniedCode = -32800
20
  )
21
 
22
  var (
{/home/stefan/go/src/Polygon/zkevm-node → .}/jsonrpc/types/interfaces.go RENAMED
@@ -23,6 +23,7 @@
23
  CountPendingTransactions(ctx context.Context) (uint64, error)
24
  GetTransactionByHash(ctx context.Context, hash common.Hash) (*pool.Transaction, error)
25
  GetTransactionByL2Hash(ctx context.Context, hash common.Hash) (*pool.Transaction, error)
 
26
  CalculateEffectiveGasPrice(rawTx []byte, txGasPrice *big.Int, txGasUsed uint64, l1GasPrice uint64, l2GasPrice uint64) (*big.Int, error)
27
  CalculateEffectiveGasPricePercentage(gasPrice *big.Int, effectiveGasPrice *big.Int) (uint8, error)
28
  EffectiveGasPriceEnabled() bool
 
23
  CountPendingTransactions(ctx context.Context) (uint64, error)
24
  GetTransactionByHash(ctx context.Context, hash common.Hash) (*pool.Transaction, error)
25
  GetTransactionByL2Hash(ctx context.Context, hash common.Hash) (*pool.Transaction, error)
26
+ CheckPolicy(ctx context.Context, policy pool.PolicyName, address common.Address) (bool, error)
27
  CalculateEffectiveGasPrice(rawTx []byte, txGasPrice *big.Int, txGasUsed uint64, l1GasPrice uint64, l2GasPrice uint64) (*big.Int, error)
28
  CalculateEffectiveGasPricePercentage(gasPrice *big.Int, effectiveGasPrice *big.Int) (uint8, error)
29
  EffectiveGasPriceEnabled() bool
{/home/stefan/go/src/Polygon/zkevm-node → .}/merkletree/tree.go RENAMED
@@ -93,9 +93,6 @@
93
  }
94
 
95
  k := new(big.Int).SetBytes(scCodeHash)
96
- if k.Cmp(big.NewInt(0)) == 0 {
97
- return []byte{}, nil
98
- }
99
 
100
  // this code gets actual smart contract code from sc code storage
101
  scCode, err := tree.getProgram(ctx, scalarToh4(k))
 
93
  }
94
 
95
  k := new(big.Int).SetBytes(scCodeHash)
 
 
 
96
 
97
  // this code gets actual smart contract code from sc code storage
98
  scCode, err := tree.getProgram(ctx, scalarToh4(k))
{/home/stefan/go/src/Polygon/zkevm-node → .}/merkletree/tree_test.go RENAMED
@@ -1,86 +0,0 @@
1
- package merkletree
2
-
3
- import (
4
- "context"
5
- "fmt"
6
- "testing"
7
-
8
- "github.com/0xPolygonHermez/zkevm-node/hex"
9
- "github.com/0xPolygonHermez/zkevm-node/test/contracts/bin/EmitLog2"
10
- "github.com/0xPolygonHermez/zkevm-node/test/testutils"
11
- "github.com/ethereum/go-ethereum/common"
12
- "github.com/google/uuid"
13
- "github.com/stretchr/testify/require"
14
- )
15
-
16
- func TestGetCode(t *testing.T) {
17
- ctx := context.Background()
18
- zkProverURI := testutils.GetEnv("ZKPROVER_URI", "localhost")
19
-
20
- cfg := Config{URI: fmt.Sprintf("%s:50061", zkProverURI)}
21
- c, _, _ := NewMTDBServiceClient(ctx, cfg)
22
- sTree := NewStateTree(c)
23
-
24
- type testCase struct {
25
- name string
26
- addr common.Address
27
- root []byte
28
- expectedResult []byte
29
- expectedError error
30
- setup func(*testing.T, *testCase, *StateTree)
31
- }
32
-
33
- testCases := []testCase{
34
- {
35
- name: "get existent code successfully",
36
- addr: common.HexToAddress("0x1"),
37
- root: common.HexToHash("0x0").Bytes(),
38
- expectedResult: hex.DecodeBig(EmitLog2.EmitLog2Bin).Bytes(),
39
- expectedError: nil,
40
- setup: func(t *testing.T, tc *testCase, sTree *StateTree) {
41
- txID := uuid.NewString()
42
-
43
- err := sTree.StartBlock(ctx, common.Hash(tc.root), txID)
44
- require.NoError(t, err)
45
-
46
- newRoot, _, err := sTree.SetCode(ctx, tc.addr, tc.expectedResult, tc.root, txID)
47
- require.NoError(t, err)
48
- tc.root = newRoot
49
-
50
- err = sTree.FinishBlock(ctx, common.Hash(tc.root), txID)
51
- require.NoError(t, err)
52
-
53
- err = sTree.Flush(ctx, common.Hash(newRoot), txID)
54
- require.NoError(t, err)
55
- },
56
- },
57
- {
58
- name: "get non-existent code successfully",
59
- addr: common.HexToAddress("0x2"),
60
- root: common.HexToHash("0x0").Bytes(),
61
- expectedResult: []byte{},
62
- expectedError: nil,
63
- setup: func(t *testing.T, tc *testCase, sTree *StateTree) {
64
- },
65
- },
66
- }
67
-
68
- for _, tc := range testCases {
69
- t.Run(tc.name, func(t *testing.T) {
70
- tc := tc
71
- tc.setup(t, &tc, sTree)
72
-
73
- result, err := sTree.GetCode(ctx, tc.addr, tc.root)
74
- require.NoError(t, err)
75
-
76
- if tc.expectedResult != nil || result != nil {
77
- require.Equal(t, len(tc.expectedResult), len(result))
78
- require.ElementsMatch(t, tc.expectedResult, result)
79
- }
80
-
81
- if tc.expectedError != nil || err != nil {
82
- require.Equal(t, tc.expectedError, err)
83
- }
84
- })
85
- }
86
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
{/home/stefan/go/src/Polygon/zkevm-node → .}/pool/errors.go RENAMED
@@ -76,4 +76,13 @@
76
 
77
  // ErrZeroL1GasPrice is returned if the L1 gas price is 0.
78
  ErrZeroL1GasPrice = errors.New("L1 gas price 0")
 
 
 
 
 
 
 
 
 
79
  )
 
76
 
77
  // ErrZeroL1GasPrice is returned if the L1 gas price is 0.
78
  ErrZeroL1GasPrice = errors.New("L1 gas price 0")
79
+
80
+ // ErrSenderDisallowedSendTx is returned when transactions by sender are is disallowed by policy
81
+ ErrSenderDisallowedSendTx = errors.New("sender disallowed send_tx by policy")
82
+
83
+ // ErrContractDisallowedSendTx is returned when transactions to contract are is disallowed by policy
84
+ ErrContractDisallowedSendTx = errors.New("contract disallowed send_tx by policy")
85
+
86
+ // ErrSenderDisallowedDeploy is returned when deploy transactions are disallowed by policy
87
+ ErrSenderDisallowedDeploy = errors.New("sender disallowed deploy by policy")
88
  )
{/home/stefan/go/src/Polygon/zkevm-node → .}/pool/interfaces.go RENAMED
@@ -38,6 +38,7 @@
38
  MarkWIPTxsAsPending(ctx context.Context) error
39
  GetAllAddressesBlocked(ctx context.Context) ([]common.Address, error)
40
  MinL2GasPriceSince(ctx context.Context, timestamp time.Time) (uint64, error)
 
41
  GetEarliestProcessedTx(ctx context.Context) (common.Hash, error)
42
  }
43
 
@@ -48,3 +49,12 @@
48
  GetTransactionByHash(ctx context.Context, transactionHash common.Hash, dbTx pgx.Tx) (*types.Transaction, error)
49
  PreProcessTransaction(ctx context.Context, tx *types.Transaction, dbTx pgx.Tx) (*state.ProcessBatchResponse, error)
50
  }
 
 
 
 
 
 
 
 
 
 
38
  MarkWIPTxsAsPending(ctx context.Context) error
39
  GetAllAddressesBlocked(ctx context.Context) ([]common.Address, error)
40
  MinL2GasPriceSince(ctx context.Context, timestamp time.Time) (uint64, error)
41
+ policy
42
  GetEarliestProcessedTx(ctx context.Context) (common.Hash, error)
43
  }
44
 
 
49
  GetTransactionByHash(ctx context.Context, transactionHash common.Hash, dbTx pgx.Tx) (*types.Transaction, error)
50
  PreProcessTransaction(ctx context.Context, tx *types.Transaction, dbTx pgx.Tx) (*state.ProcessBatchResponse, error)
51
  }
52
+ type policy interface {
53
+ CheckPolicy(ctx context.Context, policy PolicyName, address common.Address) (bool, error)
54
+ AddAddressesToPolicy(ctx context.Context, policy PolicyName, addresses []common.Address) error
55
+ RemoveAddressesFromPolicy(ctx context.Context, policy PolicyName, addresses []common.Address) error
56
+ ClearPolicy(ctx context.Context, policy PolicyName) error
57
+ DescribePolicies(ctx context.Context) ([]Policy, error)
58
+ DescribePolicy(ctx context.Context, name PolicyName) (Policy, error)
59
+ ListAcl(ctx context.Context, policy PolicyName, query []common.Address) ([]common.Address, error)
60
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/pool/pgpoolstorage/policy.go RENAMED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package pgpoolstorage
2
+
3
+ import (
4
+ "context"
5
+ "errors"
6
+ "fmt"
7
+ "strings"
8
+
9
+ "github.com/0xPolygonHermez/zkevm-node/pool"
10
+ "github.com/ethereum/go-ethereum/common"
11
+ "github.com/jackc/pgx/v4"
12
+ )
13
+
14
+ // CheckPolicy returns the rule for the named policy and address. If the address is associated with the policy, the rule
15
+ // will be the setting for the policy. If the address is no associated with the policy, the rule will be the opposite of
16
+ // the policy setting.
17
+ func (p *PostgresPoolStorage) CheckPolicy(ctx context.Context, policy pool.PolicyName, address common.Address) (bool, error) {
18
+ sql := `SELECT
19
+ CASE WHEN a.address is null THEN
20
+ NOT p.allow
21
+ ELSE
22
+ p.allow
23
+ END
24
+ FROM pool.policy p
25
+ LEFT JOIN pool.acl a
26
+ ON p.name = a.policy
27
+ AND a.address = $1
28
+ WHERE p.name = $2`
29
+
30
+ rows, err := p.db.Query(ctx, sql, address.Hex(), policy)
31
+
32
+ if errors.Is(err, pgx.ErrNoRows) {
33
+ return false, pool.ErrNotFound
34
+ } else if err != nil {
35
+ return false, err
36
+ }
37
+
38
+ defer rows.Close()
39
+ if !rows.Next() { // should always be a row if the policy exists
40
+ return false, nil
41
+ }
42
+
43
+ var allow bool
44
+ err = rows.Scan(&allow)
45
+ if err != nil {
46
+ return false, err
47
+ }
48
+ return allow, nil
49
+ }
50
+
51
+ // UpdatePolicy sets the allow/deny rule for the named policy
52
+ func (p *PostgresPoolStorage) UpdatePolicy(ctx context.Context, policy pool.PolicyName, allow bool) error {
53
+ sql := "UPDATE pool.policy SET allow = $1 WHERE name = $2"
54
+ _, err := p.db.Exec(ctx, sql, allow, string(policy))
55
+ if err != nil {
56
+ return err
57
+ }
58
+ return nil
59
+ }
60
+
61
+ // AddAddressesToPolicy adds addresses to the named policy
62
+ func (p *PostgresPoolStorage) AddAddressesToPolicy(ctx context.Context, policy pool.PolicyName, addresses []common.Address) error {
63
+ sql := "INSERT INTO pool.acl (policy, address) VALUES ($1, $2) ON CONFLICT DO NOTHING"
64
+ tx, err := p.db.Begin(ctx)
65
+ if err != nil {
66
+ return err
67
+ }
68
+ defer func(tx pgx.Tx, ctx context.Context) {
69
+ _ = tx.Rollback(ctx)
70
+ }(tx, ctx)
71
+
72
+ for _, a := range addresses {
73
+ _, err = tx.Exec(ctx, sql, policy, a.Hex())
74
+ if err != nil {
75
+ return err
76
+ }
77
+ }
78
+ err = tx.Commit(ctx)
79
+ if err != nil {
80
+ return nil
81
+ }
82
+ return nil
83
+ }
84
+
85
+ // RemoveAddressesFromPolicy removes addresses from the named policy
86
+ func (p *PostgresPoolStorage) RemoveAddressesFromPolicy(ctx context.Context, policy pool.PolicyName, addresses []common.Address) error {
87
+ sql := "DELETE FROM pool.acl WHERE policy = $1 AND address = $2"
88
+ tx, err := p.db.Begin(ctx)
89
+ if err != nil {
90
+ return err
91
+ }
92
+ defer func(tx pgx.Tx, ctx context.Context) {
93
+ _ = tx.Rollback(ctx)
94
+ }(tx, ctx)
95
+
96
+ for _, a := range addresses {
97
+ _, err = tx.Exec(ctx, sql, policy, a.Hex())
98
+ if err != nil {
99
+ return err
100
+ }
101
+ }
102
+ err = tx.Commit(ctx)
103
+ if err != nil {
104
+ return err
105
+ }
106
+ return nil
107
+ }
108
+
109
+ // ClearPolicy removes _all_ addresses from the named policy
110
+ func (p *PostgresPoolStorage) ClearPolicy(ctx context.Context, policy pool.PolicyName) error {
111
+ sql := "DELETE FROM pool.acl WHERE policy = $1"
112
+ _, err := p.db.Exec(ctx, sql, policy)
113
+ if err != nil {
114
+ return err
115
+ }
116
+ return nil
117
+ }
118
+
119
+ // DescribePolicies return all the policies
120
+ func (p *PostgresPoolStorage) DescribePolicies(ctx context.Context) ([]pool.Policy, error) {
121
+ sql := "SELECT name, allow FROM pool.policy"
122
+ rows, err := p.db.Query(ctx, sql)
123
+ if err != nil {
124
+ if errors.Is(err, pgx.ErrNoRows) {
125
+ return nil, nil
126
+ } else {
127
+ return nil, err
128
+ }
129
+ }
130
+ defer rows.Close()
131
+
132
+ var list []pool.Policy
133
+ for rows.Next() {
134
+ var name string
135
+ var allow bool
136
+ err = rows.Scan(&name, &allow)
137
+ if err != nil {
138
+ return nil, err
139
+ }
140
+ if pool.IsPolicy(name) { // skip unknown
141
+ p := pool.Policy{
142
+ Name: pool.PolicyName(name),
143
+ Allow: allow,
144
+ }
145
+ list = append(list, p)
146
+ }
147
+ }
148
+ return list, nil
149
+ }
150
+
151
+ // DescribePolicy returns the named policy
152
+ func (p *PostgresPoolStorage) DescribePolicy(ctx context.Context, name pool.PolicyName) (pool.Policy, error) {
153
+ sql := "SELECT name, allow FROM pool.policy WHERE name = $1 LIMIT 1"
154
+ row := p.db.QueryRow(ctx, sql, name)
155
+ var (
156
+ pName string
157
+ allow bool
158
+ )
159
+ err := row.Scan(&pName, &allow)
160
+ if err != nil {
161
+ return pool.Policy{}, err
162
+ }
163
+ return pool.Policy{
164
+ Name: pool.PolicyName(pName),
165
+ Allow: allow,
166
+ }, nil
167
+ }
168
+
169
+ // ListAcl returns a list of the addresses associated with the policy
170
+ func (p *PostgresPoolStorage) ListAcl(
171
+ ctx context.Context, policy pool.PolicyName, query []common.Address) ([]common.Address, error) {
172
+ sql := "SELECT address FROM pool.acl WHERE policy = $1"
173
+
174
+ if len(query) > 0 {
175
+ var addrs []string
176
+ for _, a := range query {
177
+ addrs = append(addrs, a.Hex())
178
+ }
179
+ sql = sql + fmt.Sprintf(" IN (%v)", strings.Join(addrs, ","))
180
+ }
181
+
182
+ rows, err := p.db.Query(ctx, sql, string(policy))
183
+ if err != nil {
184
+ if errors.Is(err, pgx.ErrNoRows) {
185
+ return nil, nil
186
+ } else {
187
+ return nil, err
188
+ }
189
+ }
190
+ defer rows.Close()
191
+
192
+ var addresses []common.Address
193
+ for rows.Next() {
194
+ var addr string
195
+ err = rows.Scan(&addr)
196
+ if err != nil {
197
+ return nil, err
198
+ }
199
+ addresses = append(addresses, common.HexToAddress(addr))
200
+ }
201
+ return addresses, nil
202
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/pool/policy.go RENAMED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package pool
2
+
3
+ import "github.com/ethereum/go-ethereum/common"
4
+
5
+ // PolicyName is a named policy
6
+ type PolicyName string
7
+
8
+ const (
9
+ // SendTx is the name of the policy that governs that an address may send transactions to pool
10
+ SendTx PolicyName = "send_tx"
11
+ // Deploy is the name of the policy that governs that an address may deploy a contract
12
+ Deploy PolicyName = "deploy"
13
+ )
14
+
15
+ // Policy describes state of a named policy
16
+ type Policy struct {
17
+ Name PolicyName
18
+ Allow bool
19
+ }
20
+
21
+ // Desc returns the string representation of a policy rule
22
+ func (p *Policy) Desc() string {
23
+ if p.Allow {
24
+ return "allow"
25
+ }
26
+ return "deny"
27
+ }
28
+
29
+ // Acl describes exception to a named Policy by address
30
+ type Acl struct {
31
+ PolicyName PolicyName
32
+ Address common.Address
33
+ }
34
+
35
+ // IsPolicy tests if a string represents a known named Policy
36
+ func IsPolicy(name string) bool {
37
+ for _, p := range []PolicyName{SendTx, Deploy} {
38
+ if name == string(p) {
39
+ return true
40
+ }
41
+ }
42
+ return false
43
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/pool/pool.go RENAMED
@@ -93,6 +93,13 @@
93
  time.Sleep(cfg.IntervalToRefreshGasPrices.Duration)
94
  }
95
  }(&cfg, p)
 
 
 
 
 
 
 
96
 
97
  return p
98
  }
@@ -239,7 +246,6 @@
239
  }
240
 
241
  poolTx := NewTransaction(tx, ip, isWIP)
242
- poolTx.GasUsed = preExecutionResponse.txResponse.GasUsed
243
  poolTx.ZKCounters = preExecutionResponse.usedZKCounters
244
  poolTx.ReservedZKCounters = preExecutionResponse.reservedZKCounters
245
 
@@ -729,3 +735,8 @@
729
  }
730
  return gas, nil
731
  }
 
 
 
 
 
 
93
  time.Sleep(cfg.IntervalToRefreshGasPrices.Duration)
94
  }
95
  }(&cfg, p)
96
+ p.refreshBlockedAddresses()
97
+ go func(cfg *Config, p *Pool) {
98
+ for {
99
+ time.Sleep(cfg.IntervalToRefreshBlockedAddresses.Duration)
100
+ p.refreshBlockedAddresses()
101
+ }
102
+ }(&cfg, p)
103
 
104
  return p
105
  }
 
246
  }
247
 
248
  poolTx := NewTransaction(tx, ip, isWIP)
 
249
  poolTx.ZKCounters = preExecutionResponse.usedZKCounters
250
  poolTx.ReservedZKCounters = preExecutionResponse.reservedZKCounters
251
 
 
735
  }
736
  return gas, nil
737
  }
738
+
739
+ // CheckPolicy checks if an address is allowed by policy name
740
+ func (p *Pool) CheckPolicy(ctx context.Context, policy PolicyName, address common.Address) (bool, error) {
741
+ return p.storage.CheckPolicy(ctx, policy, address)
742
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/pool/pool_test.go RENAMED
@@ -2032,3 +2032,69 @@
2032
  require.NoError(t, err)
2033
  return signedTx
2034
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2032
  require.NoError(t, err)
2033
  return signedTx
2034
  }
2035
+
2036
+ func Test_PolicyAcl(t *testing.T) {
2037
+ initOrResetDB(t)
2038
+
2039
+ poolSqlDB, err := db.NewSQLDB(poolDBCfg)
2040
+ require.NoError(t, err)
2041
+ defer poolSqlDB.Close() //nolint:gosec,errcheck
2042
+
2043
+ ctx := context.Background()
2044
+ s, err := pgpoolstorage.NewPostgresPoolStorage(poolDBCfg)
2045
+ require.NoError(t, err)
2046
+
2047
+ p := pool.NewPool(cfg, bc, s, nil, uint64(1), nil)
2048
+
2049
+ randAddr := func() common.Address {
2050
+ buf := make([]byte, 20)
2051
+ _, err = rand.Read(buf)
2052
+ require.NoError(t, err)
2053
+ return common.BytesToAddress(buf)
2054
+ }
2055
+
2056
+ // Policies start out as deny lists, since there are no addresses on the
2057
+ // lists, random addresses will always be allowed
2058
+ for _, policy := range []pool.PolicyName{pool.SendTx, pool.Deploy} {
2059
+ allow, err := p.CheckPolicy(ctx, policy, randAddr())
2060
+ require.NoError(t, err)
2061
+ require.True(t, allow)
2062
+ }
2063
+
2064
+ addr := randAddr()
2065
+
2066
+ // put addr on lists
2067
+ for _, policy := range []pool.PolicyName{pool.SendTx, pool.Deploy} {
2068
+ ctag, err := poolSqlDB.Exec(ctx, "INSERT INTO pool.acl (policy, address) VALUES ($1,$2)", policy, addr.Hex())
2069
+ require.NoError(t, err)
2070
+ require.Equal(t, int64(1), ctag.RowsAffected())
2071
+ }
2072
+
2073
+ // addr should not be denied by policy
2074
+ for _, policy := range []pool.PolicyName{pool.SendTx, pool.Deploy} {
2075
+ allow, err := p.CheckPolicy(ctx, policy, addr)
2076
+ require.NoError(t, err)
2077
+ require.False(t, allow)
2078
+ }
2079
+
2080
+ // change policies to allow by acl
2081
+ ctag, err := poolSqlDB.Exec(ctx, "UPDATE pool.policy SET allow = true")
2082
+ require.NoError(t, err)
2083
+ require.Equal(t, int64(2), ctag.RowsAffected())
2084
+
2085
+ // addr is now allowed
2086
+ for _, policy := range []pool.PolicyName{pool.SendTx, pool.Deploy} {
2087
+ allow, err := p.CheckPolicy(ctx, policy, addr)
2088
+ require.NoError(t, err)
2089
+ require.True(t, allow)
2090
+ }
2091
+
2092
+ // random addrs are now denied
2093
+ for _, policy := range []pool.PolicyName{pool.SendTx, pool.Deploy} {
2094
+ for _, a := range []common.Address{randAddr(), randAddr()} {
2095
+ allow, err := s.CheckPolicy(ctx, policy, a)
2096
+ require.NoError(t, err)
2097
+ require.False(t, allow)
2098
+ }
2099
+ }
2100
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/proto/src/proto/executor/v1/executor.proto RENAMED
@@ -292,6 +292,7 @@
292
  // prior to executing the call.
293
  map<string, OverrideAccountV2> state_override = 23;
294
  DebugV2 debug = 24;
 
295
  }
296
 
297
  message L1DataV2 {
 
292
  // prior to executing the call.
293
  map<string, OverrideAccountV2> state_override = 23;
294
  DebugV2 debug = 24;
295
+ uint64 execution_mode = 25;
296
  }
297
 
298
  message L1DataV2 {
{/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/batch.go RENAMED
@@ -352,12 +352,16 @@
352
 
353
  // Log batch detailed info
354
  log.Errorf("batch %d sanity check error: initialStateRoot: %s, expectedNewStateRoot: %s", batch.BatchNumber, initialStateRoot, expectedNewStateRoot)
355
- for i, rawL2block := range rawL2Blocks.Blocks {
356
- log.Infof("block[%d], txs: %d, deltaTimestamp: %d, l1InfoTreeIndex: %d", i, len(rawL2block.Transactions), rawL2block.DeltaTimestamp, rawL2block.IndexL1InfoTree)
357
- for j, rawTx := range rawL2block.Transactions {
358
- log.Infof("block[%d].tx[%d]: %s, egpPct: %d, data: %s", batch.BatchNumber, i, j, rawTx.Tx.Hash(), rawTx.EfficiencyPercentage, hex.EncodeToHex(rawTx.Data))
 
 
 
359
  }
360
  }
 
361
 
362
  f.Halt(ctx, fmt.Errorf("batch sanity check error. Check previous errors in logs to know which was the cause"), false)
363
  }
@@ -385,6 +389,7 @@
385
  ForkID: f.stateIntf.GetForkIDByBatchNumber(batch.BatchNumber),
386
  SkipVerifyL1InfoRoot_V2: true,
387
  Caller: caller,
 
388
  }
389
  batchRequest.L1InfoTreeData_V2, _, _, err = f.stateIntf.GetL1InfoTreeDataFromBatchL2Data(ctx, batch.BatchL2Data, nil)
390
  if err != nil {
 
352
 
353
  // Log batch detailed info
354
  log.Errorf("batch %d sanity check error: initialStateRoot: %s, expectedNewStateRoot: %s", batch.BatchNumber, initialStateRoot, expectedNewStateRoot)
355
+ batchLog := ""
356
+ totalTxs := 0
357
+ for blockIdx, rawL2block := range rawL2Blocks.Blocks {
358
+ totalTxs += len(rawL2block.Transactions)
359
+ batchLog += fmt.Sprintf("block[%d], txs: %d, deltaTimestamp: %d, l1InfoTreeIndex: %d\n", blockIdx, len(rawL2block.Transactions), rawL2block.DeltaTimestamp, rawL2block.IndexL1InfoTree)
360
+ for txIdx, rawTx := range rawL2block.Transactions {
361
+ batchLog += fmt.Sprintf(" tx[%d]: %s, egpPct: %d\n", txIdx, rawTx.Tx.Hash(), rawTx.EfficiencyPercentage)
362
  }
363
  }
364
+ log.Infof("DUMP batch %d, blocks: %d, txs: %d\n%s", batch.BatchNumber, len(rawL2Blocks.Blocks), totalTxs, batchLog)
365
 
366
  f.Halt(ctx, fmt.Errorf("batch sanity check error. Check previous errors in logs to know which was the cause"), false)
367
  }
 
389
  ForkID: f.stateIntf.GetForkIDByBatchNumber(batch.BatchNumber),
390
  SkipVerifyL1InfoRoot_V2: true,
391
  Caller: caller,
392
+ ExecutionMode: executor.ExecutionMode0,
393
  }
394
  batchRequest.L1InfoTreeData_V2, _, _, err = f.stateIntf.GetL1InfoTreeDataFromBatchL2Data(ctx, batch.BatchL2Data, nil)
395
  if err != nil {
{/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/finalizer.go RENAMED
@@ -277,6 +277,7 @@
277
  continue
278
  }
279
 
 
280
  metrics.WorkerProcessingTime(time.Since(start))
281
  if tx != nil {
282
  showNotFoundTxLog = true
@@ -284,7 +285,8 @@
284
  firstTxProcess := true
285
 
286
  for {
287
- _, err := f.processTransaction(ctx, tx, firstTxProcess)
 
288
  if err != nil {
289
  if err == ErrEffectiveGasPriceReprocess {
290
  firstTxProcess = false
@@ -319,7 +321,11 @@
319
  }
320
 
321
  // Check if we must finalize the batch due to a closing reason (resources exhausted, max txs, timestamp resolution, forced batches deadline)
322
- if finalize, closeReason := f.checkIfFinalizeBatch(); finalize {
 
 
 
 
323
  f.finalizeWIPBatch(ctx, closeReason)
324
  }
325
 
@@ -353,6 +359,7 @@
353
  SkipWriteBlockInfoRoot_V2: true,
354
  SkipVerifyL1InfoRoot_V2: true,
355
  L1InfoTreeData_V2: map[uint32]state.L1DataV2{},
 
356
  }
357
 
358
  txGasPrice := tx.GasPrice
@@ -584,6 +591,10 @@
584
 
585
  f.updateWorkerAfterSuccessfulProcessing(ctx, tx.Hash, tx.From, false, result)
586
 
 
 
 
 
587
  return nil, nil
588
  }
589
 
 
277
  continue
278
  }
279
 
280
+ closeWIPBatch := false
281
  metrics.WorkerProcessingTime(time.Since(start))
282
  if tx != nil {
283
  showNotFoundTxLog = true
 
285
  firstTxProcess := true
286
 
287
  for {
288
+ var err error
289
+ _, err = f.processTransaction(ctx, tx, firstTxProcess)
290
  if err != nil {
291
  if err == ErrEffectiveGasPriceReprocess {
292
  firstTxProcess = false
 
321
  }
322
 
323
  // Check if we must finalize the batch due to a closing reason (resources exhausted, max txs, timestamp resolution, forced batches deadline)
324
+ finalize, closeReason := f.checkIfFinalizeBatch()
325
+ if closeWIPBatch || finalize {
326
+ if closeWIPBatch {
327
+ closeReason = "Executor close batch"
328
+ }
329
  f.finalizeWIPBatch(ctx, closeReason)
330
  }
331
 
 
359
  SkipWriteBlockInfoRoot_V2: true,
360
  SkipVerifyL1InfoRoot_V2: true,
361
  L1InfoTreeData_V2: map[uint32]state.L1DataV2{},
362
+ ExecutionMode: executor.ExecutionMode0,
363
  }
364
 
365
  txGasPrice := tx.GasPrice
 
591
 
592
  f.updateWorkerAfterSuccessfulProcessing(ctx, tx.Hash, tx.From, false, result)
593
 
594
+ if result.CloseBatch_V2 {
595
+ return nil, nil
596
+ }
597
+
598
  return nil, nil
599
  }
600
 
{/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/forcedbatch.go RENAMED
@@ -105,6 +106,7 @@
105
  ForkID: f.stateIntf.GetForkIDByBatchNumber(lastBatchNumber),
106
  SkipVerifyL1InfoRoot_V2: true,
107
  Caller: stateMetrics.SequencerCallerLabel,
 
108
  }
109
 
110
  batchResponse, err := f.stateIntf.ProcessBatchV2(ctx, batchRequest, true)
 
106
  ForkID: f.stateIntf.GetForkIDByBatchNumber(lastBatchNumber),
107
  SkipVerifyL1InfoRoot_V2: true,
108
  Caller: stateMetrics.SequencerCallerLabel,
109
+ ExecutionMode: executor.ExecutionMode0,
110
  }
111
 
112
  batchResponse, err := f.stateIntf.ProcessBatchV2(ctx, batchRequest, true)
{/home/stefan/go/src/Polygon/zkevm-node → .}/sequencer/l2block.go RENAMED
@@ -273,6 +274,7 @@
273
  ForkID: f.stateIntf.GetForkIDByBatchNumber(f.wipBatch.batchNumber),
274
  SkipVerifyL1InfoRoot_V2: true,
275
  L1InfoTreeData_V2: map[uint32]state.L1DataV2{},
 
276
  }
277
  batchRequest.L1InfoTreeData_V2[l2Block.l1InfoTreeExitRoot.L1InfoTreeIndex] = state.L1DataV2{
278
  GlobalExitRoot: l2Block.l1InfoTreeExitRoot.GlobalExitRoot.GlobalExitRoot,
@@ -298,7 +300,7 @@
298
  }
299
 
300
  if batchResponse.IsRomOOCError {
301
- executeL2BLockError(err)
302
  return nil, 0, ErrProcessBatchOOC
303
  }
304
 
@@ -570,6 +572,7 @@
570
  SkipFirstChangeL2Block_V2: false,
571
  Transactions: f.stateIntf.BuildChangeL2Block(f.wipL2Block.deltaTimestamp, f.wipL2Block.getL1InfoTreeIndex()),
572
  L1InfoTreeData_V2: map[uint32]state.L1DataV2{},
 
573
  }
574
 
575
  batchRequest.L1InfoTreeData_V2[f.wipL2Block.l1InfoTreeExitRoot.L1InfoTreeIndex] = state.L1DataV2{
 
274
  ForkID: f.stateIntf.GetForkIDByBatchNumber(f.wipBatch.batchNumber),
275
  SkipVerifyL1InfoRoot_V2: true,
276
  L1InfoTreeData_V2: map[uint32]state.L1DataV2{},
277
+ ExecutionMode: executor.ExecutionMode0,
278
  }
279
  batchRequest.L1InfoTreeData_V2[l2Block.l1InfoTreeExitRoot.L1InfoTreeIndex] = state.L1DataV2{
280
  GlobalExitRoot: l2Block.l1InfoTreeExitRoot.GlobalExitRoot.GlobalExitRoot,
 
300
  }
301
 
302
  if batchResponse.IsRomOOCError {
303
+ executeL2BLockError(batchResponse.RomError_V2)
304
  return nil, 0, ErrProcessBatchOOC
305
  }
306
 
 
572
  SkipFirstChangeL2Block_V2: false,
573
  Transactions: f.stateIntf.BuildChangeL2Block(f.wipL2Block.deltaTimestamp, f.wipL2Block.getL1InfoTreeIndex()),
574
  L1InfoTreeData_V2: map[uint32]state.L1DataV2{},
575
+ ExecutionMode: executor.ExecutionMode0,
576
  }
577
 
578
  batchRequest.L1InfoTreeData_V2[f.wipL2Block.l1InfoTreeExitRoot.L1InfoTreeIndex] = state.L1DataV2{
{/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/config.go RENAMED
@@ -41,4 +41,6 @@
41
  // gas offset: 100
42
  // final gas: 1100
43
  GasOffset uint64 `mapstructure:"GasOffset"`
 
 
44
  }
 
41
  // gas offset: 100
42
  // final gas: 1100
43
  GasOffset uint64 `mapstructure:"GasOffset"`
44
+ // MaxBatchesForL1 is the maximum amount of batches to be sequenced in a single L1 tx
45
+ MaxBatchesForL1 uint64 `mapstructure:"MaxBatchesForL1"`
46
  }
{/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/interfaces.go RENAMED
@@ -17,8 +17,8 @@
17
 
18
  // etherman contains the methods required to interact with ethereum.
19
  type etherman interface {
20
- BuildSequenceBatchesTxData(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, initSequenceBatchNumber uint64, l2Coinbase common.Address) (to *common.Address, data []byte, err error)
21
- EstimateGasSequenceBatches(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, initSequenceBatchNumber uint64, l2Coinbase common.Address) (*types.Transaction, error)
22
  GetLatestBlockHeader(ctx context.Context) (*types.Header, error)
23
  GetLatestBatchNumber() (uint64, error)
24
  }
@@ -41,3 +41,7 @@
41
  Add(ctx context.Context, owner, id string, from common.Address, to *common.Address, value *big.Int, data []byte, gasOffset uint64, dbTx pgx.Tx) error
42
  ProcessPendingMonitoredTxs(ctx context.Context, owner string, failedResultHandler ethtxmanager.ResultHandler, dbTx pgx.Tx)
43
  }
 
 
 
 
 
17
 
18
  // etherman contains the methods required to interact with ethereum.
19
  type etherman interface {
20
+ BuildSequenceBatchesTxData(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, initSequenceBatchNumber uint64, l2Coinbase common.Address, committeeSignaturesAndAddrs []byte) (to *common.Address, data []byte, err error)
21
+ EstimateGasSequenceBatches(sender common.Address, sequences []ethmanTypes.Sequence, maxSequenceTimestamp uint64, initSequenceBatchNumber uint64, l2Coinbase common.Address, committeeSignaturesAndAddrs []byte) (*types.Transaction, error)
22
  GetLatestBlockHeader(ctx context.Context) (*types.Header, error)
23
  GetLatestBatchNumber() (uint64, error)
24
  }
 
41
  Add(ctx context.Context, owner, id string, from common.Address, to *common.Address, value *big.Int, data []byte, gasOffset uint64, dbTx pgx.Tx) error
42
  ProcessPendingMonitoredTxs(ctx context.Context, owner string, failedResultHandler ethtxmanager.ResultHandler, dbTx pgx.Tx)
43
  }
44
+
45
+ type dataAbilitier interface {
46
+ PostSequence(ctx context.Context, sequences []ethmanTypes.Sequence) ([]byte, error)
47
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/sequencesender.go RENAMED
@@ -6,14 +6,12 @@
6
  "fmt"
7
  "time"
8
 
9
- ethman "github.com/0xPolygonHermez/zkevm-node/etherman"
10
  "github.com/0xPolygonHermez/zkevm-node/etherman/types"
11
  "github.com/0xPolygonHermez/zkevm-node/ethtxmanager"
12
  "github.com/0xPolygonHermez/zkevm-node/event"
13
  "github.com/0xPolygonHermez/zkevm-node/log"
14
  "github.com/0xPolygonHermez/zkevm-node/sequencer/metrics"
15
  "github.com/0xPolygonHermez/zkevm-node/state"
16
- ethTypes "github.com/ethereum/go-ethereum/core/types"
17
  "github.com/jackc/pgx/v4"
18
  )
19
 
@@ -42,16 +40,18 @@
42
  ethTxManager ethTxManager
43
  etherman etherman
44
  eventLog *event.EventLog
 
45
  }
46
 
47
  // New inits sequence sender
48
- func New(cfg Config, state stateInterface, etherman etherman, manager ethTxManager, eventLog *event.EventLog) (*SequenceSender, error) {
49
  return &SequenceSender{
50
  cfg: cfg,
51
  state: state,
52
  etherman: etherman,
53
  ethTxManager: manager,
54
  eventLog: eventLog,
 
55
  }, nil
56
  }
57
 
@@ -187,9 +187,15 @@
187
  }
188
 
189
  // add sequence to be monitored
 
 
 
 
 
 
190
  firstSequence := sequences[0]
191
 
192
- to, data, err := s.etherman.BuildSequenceBatchesTxData(s.cfg.SenderAddress, sequences, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber-1, s.cfg.L2Coinbase)
193
  if err != nil {
194
  log.Error("error estimating new sequenceBatches to add to eth tx manager: ", err)
195
  return
@@ -210,7 +216,7 @@
210
  func (s *SequenceSender) getSequencesToSend(ctx context.Context) ([]types.Sequence, error) {
211
  lastVirtualBatchNum, err := s.state.GetLastVirtualBatchNum(ctx, nil)
212
  if err != nil {
213
- return nil, fmt.Errorf("failed to get last virtual batch num, err: %w", err)
214
  }
215
  log.Debugf("last virtual batch number: %d", lastVirtualBatchNum)
216
 
@@ -220,8 +226,6 @@
220
  sequences := []types.Sequence{}
221
  // var estimatedGas uint64
222
 
223
- var tx *ethTypes.Transaction
224
-
225
  // Add sequences until too big for a single L1 tx or last batch is reached
226
  for {
227
  //Check if the next batch belongs to a new forkid, in this case we need to stop sequencing as we need to
@@ -236,14 +240,14 @@
236
  if err == state.ErrNotFound {
237
  break
238
  }
239
- log.Debugf("failed to get batch by number %d, err: %w", currentBatchNumToSequence, err)
240
  return nil, err
241
  }
242
 
243
  // Check if batch is closed and checked (sequencer sanity check was successful)
244
  isChecked, err := s.state.IsBatchChecked(ctx, currentBatchNumToSequence, nil)
245
  if err != nil {
246
- log.Debugf("failed to check if batch %d is closed and checked, err: %w", currentBatchNumToSequence, err)
247
  return nil, err
248
  }
249
 
@@ -289,29 +293,13 @@
289
  }
290
 
291
  sequences = append(sequences, seq)
292
- // Check if can be send
293
- firstSequence := sequences[0]
294
- lastSequence := sequences[len(sequences)-1]
295
- tx, err = s.etherman.EstimateGasSequenceBatches(s.cfg.SenderAddress, sequences, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber-1, s.cfg.L2Coinbase)
296
- if err == nil && tx.Size() > s.cfg.MaxTxSizeForL1 {
297
- metrics.SequencesOvesizedDataError()
298
- log.Infof("oversized Data on TX oldHash %s (txSize %d > %d)", tx.Hash(), tx.Size(), s.cfg.MaxTxSizeForL1)
299
- err = ErrOversizedData
300
- }
301
- if err != nil {
302
- log.Infof("Handling estimage gas send sequence error: %v", err)
303
- sequences, err = s.handleEstimateGasSendSequenceErr(ctx, sequences, currentBatchNumToSequence, err)
304
- if sequences != nil {
305
- if len(sequences) > 0 {
306
- // Handling the error gracefully, re-processing the sequence as a sanity check
307
- lastSequence = sequences[len(sequences)-1]
308
- _, err = s.etherman.EstimateGasSequenceBatches(s.cfg.SenderAddress, sequences, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber-1, s.cfg.L2Coinbase)
309
- return sequences, err
310
- }
311
- }
312
- return sequences, err
313
  }
314
- // estimatedGas = tx.Gas()
315
 
316
  //Check if the current batch is the last before a change to a new forkid, in this case we need to close and send the sequence to L1
317
  if (s.cfg.ForkUpgradeBatchNumber != 0) && (currentBatchNumToSequence == (s.cfg.ForkUpgradeBatchNumber)) {
@@ -346,78 +334,6 @@
346
  return nil, nil
347
  }
348
 
349
- // handleEstimateGasSendSequenceErr handles an error on the estimate gas. It will return:
350
- // nil, error: impossible to handle gracefully
351
- // sequence, nil: handled gracefully. Potentially manipulating the sequences
352
- // nil, nil: a situation that requires waiting
353
- func (s *SequenceSender) handleEstimateGasSendSequenceErr(
354
- ctx context.Context,
355
- sequences []types.Sequence,
356
- currentBatchNumToSequence uint64,
357
- err error,
358
- ) ([]types.Sequence, error) {
359
- // Insufficient allowance
360
- if errors.Is(err, ethman.ErrInsufficientAllowance) {
361
- return nil, err
362
- }
363
- if isDataForEthTxTooBig(err) {
364
- // Remove the latest item and send the sequences
365
- log.Infof(
366
- "Done building sequences, selected batches to %d. Batch %d caused the L1 tx to be too big",
367
- currentBatchNumToSequence-1, currentBatchNumToSequence,
368
- )
369
- sequences = sequences[:len(sequences)-1]
370
- return sequences, nil
371
- }
372
-
373
- // while estimating gas a new block is not created and the POE SC may return
374
- // an error regarding timestamp verification, this must be handled
375
- // if errors.Is(err, ethman.ErrTimestampMustBeInsideRange) {
376
- // // query the sc about the value of its lastTimestamp variable
377
- // lastTimestamp, err := s.etherman.GetLastBatchTimestamp()
378
- // if err != nil {
379
- // return nil, err
380
- // }
381
- // // check POE SC lastTimestamp against sequences' one
382
- // for _, seq := range sequences {
383
- // if seq.Timestamp < int64(lastTimestamp) {
384
- // // TODO: gracefully handle this situation by creating an L2 reorg
385
- // log.Fatalf("sequence timestamp %d is < POE SC lastTimestamp %d", seq.Timestamp, lastTimestamp)
386
- // }
387
- // lastTimestamp = uint64(seq.Timestamp)
388
- // }
389
- // blockTimestamp, err := s.etherman.GetLatestBlockTimestamp(ctx)
390
- // if err != nil {
391
- // log.Error("error getting block timestamp: ", err)
392
- // }
393
- // log.Debugf("block.timestamp: %d is smaller than seq.Timestamp: %d. A new block must be mined in L1 before the gas can be estimated.", blockTimestamp, sequences[0].Timestamp)
394
- // return nil, nil
395
- // }
396
-
397
- // Unknown error
398
- if len(sequences) == 1 {
399
- // TODO: gracefully handle this situation by creating an L2 reorg
400
- log.Errorf(
401
- "Error when estimating gas for BatchNum %d (alone in the sequences): %v",
402
- currentBatchNumToSequence, err,
403
- )
404
- }
405
- // Remove the latest item and send the sequences
406
- log.Infof(
407
- "Done building sequences, selected batches to %d. Batch %d excluded due to unknown error: %v",
408
- currentBatchNumToSequence, currentBatchNumToSequence+1, err,
409
- )
410
- sequences = sequences[:len(sequences)-1]
411
-
412
- return sequences, nil
413
- }
414
-
415
- func isDataForEthTxTooBig(err error) bool {
416
- return errors.Is(err, ethman.ErrGasRequiredExceedsAllowance) ||
417
- errors.Is(err, ErrOversizedData) ||
418
- errors.Is(err, ethman.ErrContentLengthTooLarge)
419
- }
420
-
421
  func (s *SequenceSender) isSynced(ctx context.Context, retries int, waitRetry time.Duration) (bool, error) {
422
  lastVirtualBatchNum, err := s.state.GetLastVirtualBatchNum(ctx, nil)
423
  if err != nil && err != state.ErrNotFound {
 
6
  "fmt"
7
  "time"
8
 
 
9
  "github.com/0xPolygonHermez/zkevm-node/etherman/types"
10
  "github.com/0xPolygonHermez/zkevm-node/ethtxmanager"
11
  "github.com/0xPolygonHermez/zkevm-node/event"
12
  "github.com/0xPolygonHermez/zkevm-node/log"
13
  "github.com/0xPolygonHermez/zkevm-node/sequencer/metrics"
14
  "github.com/0xPolygonHermez/zkevm-node/state"
 
15
  "github.com/jackc/pgx/v4"
16
  )
17
 
 
40
  ethTxManager ethTxManager
41
  etherman etherman
42
  eventLog *event.EventLog
43
+ da dataAbilitier
44
  }
45
 
46
  // New inits sequence sender
47
+ func New(cfg Config, state stateInterface, etherman etherman, manager ethTxManager, eventLog *event.EventLog, da dataAbilitier) (*SequenceSender, error) {
48
  return &SequenceSender{
49
  cfg: cfg,
50
  state: state,
51
  etherman: etherman,
52
  ethTxManager: manager,
53
  eventLog: eventLog,
54
+ da: da,
55
  }, nil
56
  }
57
 
 
187
  }
188
 
189
  // add sequence to be monitored
190
+ dataAvailabilityMessage, err := s.da.PostSequence(ctx, sequences)
191
+ if err != nil {
192
+ log.Error("error posting sequences to the data availability protocol: ", err)
193
+ return
194
+ }
195
+
196
  firstSequence := sequences[0]
197
 
198
+ to, data, err := s.etherman.BuildSequenceBatchesTxData(s.cfg.SenderAddress, sequences, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber-1, s.cfg.L2Coinbase, dataAvailabilityMessage)
199
  if err != nil {
200
  log.Error("error estimating new sequenceBatches to add to eth tx manager: ", err)
201
  return
 
216
  func (s *SequenceSender) getSequencesToSend(ctx context.Context) ([]types.Sequence, error) {
217
  lastVirtualBatchNum, err := s.state.GetLastVirtualBatchNum(ctx, nil)
218
  if err != nil {
219
+ return nil, fmt.Errorf("failed to get last virtual batch num, err: %v", err)
220
  }
221
  log.Debugf("last virtual batch number: %d", lastVirtualBatchNum)
222
 
 
226
  sequences := []types.Sequence{}
227
  // var estimatedGas uint64
228
 
 
 
229
  // Add sequences until too big for a single L1 tx or last batch is reached
230
  for {
231
  //Check if the next batch belongs to a new forkid, in this case we need to stop sequencing as we need to
 
240
  if err == state.ErrNotFound {
241
  break
242
  }
243
+ log.Debugf("failed to get batch by number %d, err: %v", currentBatchNumToSequence, err)
244
  return nil, err
245
  }
246
 
247
  // Check if batch is closed and checked (sequencer sanity check was successful)
248
  isChecked, err := s.state.IsBatchChecked(ctx, currentBatchNumToSequence, nil)
249
  if err != nil {
250
+ log.Debugf("failed to check if batch %d is closed and checked, err: %v", currentBatchNumToSequence, err)
251
  return nil, err
252
  }
253
 
 
293
  }
294
 
295
  sequences = append(sequences, seq)
296
+ if len(sequences) == int(s.cfg.MaxBatchesForL1) {
297
+ log.Info(
298
+ "sequence should be sent to L1, because MaxBatchesForL1 (%d) has been reached",
299
+ s.cfg.MaxBatchesForL1,
300
+ )
301
+ return sequences, nil
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
302
  }
 
303
 
304
  //Check if the current batch is the last before a change to a new forkid, in this case we need to close and send the sequence to L1
305
  if (s.cfg.ForkUpgradeBatchNumber != 0) && (currentBatchNumToSequence == (s.cfg.ForkUpgradeBatchNumber)) {
 
334
  return nil, nil
335
  }
336
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
337
  func (s *SequenceSender) isSynced(ctx context.Context, retries int, waitRetry time.Duration) (bool, error) {
338
  lastVirtualBatchNum, err := s.state.GetLastVirtualBatchNum(ctx, nil)
339
  if err != nil && err != state.ErrNotFound {
{/home/stefan/go/src/Polygon/zkevm-node → .}/sequencesender/sequencesender_test.go RENAMED
@@ -30,7 +30,7 @@
30
  stateMock := new(StateMock)
31
  ethermanMock := new(EthermanMock)
32
  ethTxManagerMock := new(EthTxManagerMock)
33
- ssender, err := New(Config{}, stateMock, ethermanMock, ethTxManagerMock, nil)
34
  assert.NoError(t, err)
35
 
36
  testCases := []IsSyncedTestCase{
 
30
  stateMock := new(StateMock)
31
  ethermanMock := new(EthermanMock)
32
  ethTxManagerMock := new(EthTxManagerMock)
33
+ ssender, err := New(Config{}, stateMock, ethermanMock, ethTxManagerMock, nil, nil)
34
  assert.NoError(t, err)
35
 
36
  testCases := []IsSyncedTestCase{
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/batch.go RENAMED
@@ -60,7 +60,6 @@
60
  GlobalExitRoot common.Hash
61
  ForcedBatchNum *uint64
62
  BatchL2Data *[]byte
63
- ClosingReason ClosingReason
64
  }
65
 
66
  // ClosingReason represents the reason why a batch is closed.
@@ -83,22 +82,6 @@
83
  MaxDeltaTimestampClosingReason ClosingReason = "Max delta timestamp"
84
  // NoTxFitsClosingReason is the closing reason used when any of the txs in the pool (worker) fits in the remaining resources of the batch
85
  NoTxFitsClosingReason ClosingReason = "No transaction fits"
86
-
87
- // Reason due Synchronizer
88
- // ------------------------------------------------------------------------------------------
89
-
90
- // SyncL1EventInitialBatchClosingReason is the closing reason used when a batch is closed by the synchronizer due to an initial batch (first batch mode forced)
91
- SyncL1EventInitialBatchClosingReason ClosingReason = "Sync L1: initial"
92
- // SyncL1EventSequencedBatchClosingReason is the closing reason used when a batch is closed by the synchronizer due to a sequenced batch event from L1
93
- SyncL1EventSequencedBatchClosingReason ClosingReason = "Sync L1: sequenced"
94
- // SyncL1EventSequencedForcedBatchClosingReason is the closing reason used when a batch is closed by the synchronizer due to a sequenced forced batch event from L1
95
- SyncL1EventSequencedForcedBatchClosingReason ClosingReason = "Sync L1: forced"
96
- // SyncL1EventUpdateEtrogSequenceClosingReason is the closing reason used when a batch is closed by the synchronizer due to an UpdateEtrogSequence event from L1 that inject txs
97
- SyncL1EventUpdateEtrogSequenceClosingReason ClosingReason = "Sync L1: injected"
98
- // SyncL2TrustedBatchClosingReason is the closing reason used when a batch is closed by the synchronizer due to a trusted batch from L2
99
- SyncL2TrustedBatchClosingReason ClosingReason = "Sync L2: trusted"
100
- // SyncGenesisBatchClosingReason is the closing reason used when genesis batch is created by synchronizer
101
- SyncGenesisBatchClosingReason ClosingReason = "Sync: genesis"
102
  )
103
 
104
  // ProcessingReceipt indicates the outcome (StateRoot, AccInputHash) of processing a batch
 
60
  GlobalExitRoot common.Hash
61
  ForcedBatchNum *uint64
62
  BatchL2Data *[]byte
 
63
  }
64
 
65
  // ClosingReason represents the reason why a batch is closed.
 
82
  MaxDeltaTimestampClosingReason ClosingReason = "Max delta timestamp"
83
  // NoTxFitsClosingReason is the closing reason used when any of the txs in the pool (worker) fits in the remaining resources of the batch
84
  NoTxFitsClosingReason ClosingReason = "No transaction fits"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  )
86
 
87
  // ProcessingReceipt indicates the outcome (StateRoot, AccInputHash) of processing a batch
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/batchV2.go RENAMED
@@ -33,7 +33,7 @@
33
  ForcedBlockHashL1 *common.Hash
34
  SkipVerifyL1InfoRoot uint32
35
  GlobalExitRoot common.Hash // GlobalExitRoot is not use for execute but use to OpenBatch (data on DB)
36
- ClosingReason ClosingReason
37
  }
38
 
39
  // ProcessBatchV2 processes a batch for forkID >= ETROG
@@ -68,6 +68,7 @@
68
  ChainId: s.cfg.ChainID,
69
  ForkId: request.ForkID,
70
  ContextId: uuid.NewString(),
 
71
  }
72
 
73
  if request.SkipFirstChangeL2Block_V2 {
@@ -130,6 +131,7 @@
130
  ForkId: forkId,
131
  ContextId: uuid.NewString(),
132
  SkipVerifyL1InfoRoot: skipVerifyL1InfoRoot,
 
133
  }
134
 
135
  if forcedBlockHashL1 != nil {
@@ -230,6 +232,7 @@
230
  ContextId: uuid.NewString(),
231
  SkipVerifyL1InfoRoot: processingCtx.SkipVerifyL1InfoRoot,
232
  L1InfoRoot: processingCtx.L1InfoRoot.Bytes(),
 
233
  }
234
 
235
  if processingCtx.ForcedBlockHashL1 != nil {
@@ -412,17 +415,5 @@
412
  LocalExitRoot: processedBatch.NewLocalExitRoot,
413
  AccInputHash: processedBatch.NewAccInputHash,
414
  BatchL2Data: *BatchL2Data,
415
- ClosingReason: processingCtx.ClosingReason,
416
  }, dbTx)
417
  }
418
-
419
- // BuildChangeL2Block returns a changeL2Block tx to use in the BatchL2Data
420
- func (p *State) BuildChangeL2Block(deltaTimestamp uint32, l1InfoTreeIndex uint32) []byte {
421
- l2block := ChangeL2BlockHeader{
422
- DeltaTimestamp: deltaTimestamp,
423
- IndexL1InfoTree: l1InfoTreeIndex,
424
- }
425
- var data []byte
426
- data = l2block.Encode(data)
427
- return data
428
- }
 
33
  ForcedBlockHashL1 *common.Hash
34
  SkipVerifyL1InfoRoot uint32
35
  GlobalExitRoot common.Hash // GlobalExitRoot is not use for execute but use to OpenBatch (data on DB)
36
+ ExecutionMode uint64
37
  }
38
 
39
  // ProcessBatchV2 processes a batch for forkID >= ETROG
 
68
  ChainId: s.cfg.ChainID,
69
  ForkId: request.ForkID,
70
  ContextId: uuid.NewString(),
71
+ ExecutionMode: request.ExecutionMode,
72
  }
73
 
74
  if request.SkipFirstChangeL2Block_V2 {
 
131
  ForkId: forkId,
132
  ContextId: uuid.NewString(),
133
  SkipVerifyL1InfoRoot: skipVerifyL1InfoRoot,
134
+ ExecutionMode: executor.ExecutionMode1,
135
  }
136
 
137
  if forcedBlockHashL1 != nil {
 
232
  ContextId: uuid.NewString(),
233
  SkipVerifyL1InfoRoot: processingCtx.SkipVerifyL1InfoRoot,
234
  L1InfoRoot: processingCtx.L1InfoRoot.Bytes(),
235
+ ExecutionMode: processingCtx.ExecutionMode,
236
  }
237
 
238
  if processingCtx.ForcedBlockHashL1 != nil {
 
415
  LocalExitRoot: processedBatch.NewLocalExitRoot,
416
  AccInputHash: processedBatch.NewAccInputHash,
417
  BatchL2Data: *BatchL2Data,
 
418
  }, dbTx)
419
  }
 
 
 
 
 
 
 
 
 
 
 
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/convertersV2.go RENAMED
@@ -370,7 +370,6 @@
370
  BatchL2Data: p.BatchL2Data,
371
  Timestamp: tstamp,
372
  GlobalExitRoot: p.GlobalExitRoot,
373
- ClosingReason: p.ClosingReason,
374
  }
375
  return &result, nil
376
  }
 
370
  BatchL2Data: p.BatchL2Data,
371
  Timestamp: tstamp,
372
  GlobalExitRoot: p.GlobalExitRoot,
 
373
  }
374
  return &result, nil
375
  }
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/encoding_batch_v2.go RENAMED
@@ -2,13 +2,7 @@
2
  This file provide functions to work with ETROG batches:
3
  - EncodeBatchV2 (equivalent to EncodeTransactions)
4
  - DecodeBatchV2 (equivalent to DecodeTxs)
5
- - DecodeForcedBatchV2
6
-
7
- Also provide a builder class to create batches (BatchV2Encoder):
8
- This method doesnt check anything, so is more flexible but you need to know what you are doing
9
- - `builder := NewBatchV2Encoder()` : Create a new `BatchV2Encoder``
10
- - You can call to `AddBlockHeader` or `AddTransaction` to add a block header or a transaction as you wish
11
- - You can call to `GetResult` to get the batch data
12
 
13
 
14
  // batch data format:
@@ -33,25 +27,11 @@
33
  // 0x00 | 32 | V
34
  // 0x00 | 1 | efficiencyPercentage
35
  // Repeat Transaction
36
- //
37
- // Usage:
38
- // There are 2 ways of use this module, direct calls or a builder class:
39
- // 1) Direct calls:
40
- // - EncodeBatchV2: Encode a batch of transactions
41
- // - DecodeBatchV2: Decode a batch of transactions
42
- //
43
- // 2) Builder class:
44
- // This method doesnt check anything, so is more flexible but you need to know what you are doing
45
- // - builder := NewBatchV2Encoder(): Create a new BatchV2Encoder
46
- // - You can call to `AddBlockHeader` or `AddTransaction` to add a block header or a transaction as you wish
47
- // - You can call to `GetResult` to get the batch data
48
-
49
  */
50
 
51
  package state
52
 
53
  import (
54
- "encoding/binary"
55
  "errors"
56
  "fmt"
57
  "strconv"
@@ -62,16 +42,11 @@
62
  "github.com/ethereum/go-ethereum/rlp"
63
  )
64
 
65
- // ChangeL2BlockHeader is the header of a L2 block.
66
- type ChangeL2BlockHeader struct {
67
- DeltaTimestamp uint32
68
- IndexL1InfoTree uint32
69
- }
70
-
71
  // L2BlockRaw is the raw representation of a L2 block.
72
  type L2BlockRaw struct {
73
- ChangeL2BlockHeader
74
- Transactions []L2TxRaw
 
75
  }
76
 
77
  // BatchRawV2 is the representation of a batch of transactions.
@@ -86,15 +61,12 @@
86
 
87
  // L2TxRaw is the raw representation of a L2 transaction inside a L2 block.
88
  type L2TxRaw struct {
89
- EfficiencyPercentage uint8 // valid always
90
- TxAlreadyEncoded bool // If true the tx is already encoded (data field is used)
91
- Tx types.Transaction // valid if TxAlreadyEncoded == false
92
- Data []byte // valid if TxAlreadyEncoded == true
93
  }
94
 
95
  const (
96
  changeL2Block = uint8(0x0b)
97
- sizeUInt32 = 4
98
  )
99
 
100
  var (
@@ -120,88 +92,57 @@
120
 
121
  // EncodeBatchV2 encodes a batch of transactions into a byte slice.
122
  func EncodeBatchV2(batch *BatchRawV2) ([]byte, error) {
 
 
123
  if batch == nil {
124
  return nil, fmt.Errorf("batch is nil: %w", ErrInvalidBatchV2)
125
  }
126
- if len(batch.Blocks) == 0 {
 
127
  return nil, fmt.Errorf("a batch need minimum a L2Block: %w", ErrInvalidBatchV2)
128
  }
129
-
130
- encoder := NewBatchV2Encoder()
131
- for _, block := range batch.Blocks {
132
- encoder.AddBlockHeader(block.ChangeL2BlockHeader)
133
- err := encoder.AddTransactions(block.Transactions)
134
  if err != nil {
135
- return nil, fmt.Errorf("can't encode tx: %w", err)
136
  }
137
- }
138
- return encoder.GetResult(), nil
139
- }
140
-
141
- // BatchV2Encoder is a builder of the batchl2data used by EncodeBatchV2
142
- type BatchV2Encoder struct {
143
- batchData []byte
144
- }
145
-
146
- // NewBatchV2Encoder creates a new BatchV2Encoder.
147
- func NewBatchV2Encoder() *BatchV2Encoder {
148
- return &BatchV2Encoder{}
149
- }
150
-
151
- // AddBlockHeader adds a block header to the batch.
152
- func (b *BatchV2Encoder) AddBlockHeader(l2BlockHeader ChangeL2BlockHeader) {
153
- b.batchData = l2BlockHeader.Encode(b.batchData)
154
- }
155
-
156
- // AddTransactions adds a set of transactions to the batch.
157
- func (b *BatchV2Encoder) AddTransactions(transactions []L2TxRaw) error {
158
- for _, tx := range transactions {
159
- err := b.AddTransaction(tx)
160
- if err != nil {
161
- return fmt.Errorf("can't encode tx: %w", err)
162
  }
163
  }
164
- return nil
165
- }
166
-
167
- // AddTransaction adds a transaction to the batch.
168
- func (b *BatchV2Encoder) AddTransaction(transaction L2TxRaw) error {
169
- var err error
170
- b.batchData, err = transaction.Encode(b.batchData)
171
- if err != nil {
172
- return fmt.Errorf("can't encode tx: %w", err)
173
- }
174
- return nil
175
- }
176
-
177
- // GetResult returns the batch data.
178
- func (b *BatchV2Encoder) GetResult() []byte {
179
- return b.batchData
180
  }
181
 
182
- // Encode encodes a batch of l2blocks header into a byte slice.
183
- func (c ChangeL2BlockHeader) Encode(batchData []byte) []byte {
184
  batchData = append(batchData, changeL2Block)
185
- batchData = append(batchData, encodeUint32(c.DeltaTimestamp)...)
186
- batchData = append(batchData, encodeUint32(c.IndexL1InfoTree)...)
187
- return batchData
188
  }
189
 
190
- // Encode encodes a transaction into a byte slice.
191
- func (tx L2TxRaw) Encode(batchData []byte) ([]byte, error) {
192
- if tx.TxAlreadyEncoded {
193
- batchData = append(batchData, tx.Data...)
194
- } else {
195
- rlpTx, err := prepareRLPTxData(tx.Tx)
196
- if err != nil {
197
- return nil, fmt.Errorf("can't encode tx to RLP: %w", err)
198
- }
199
- batchData = append(batchData, rlpTx...)
200
  }
 
201
  batchData = append(batchData, tx.EfficiencyPercentage)
202
  return batchData, nil
203
  }
204
 
 
 
 
 
 
 
 
 
 
205
  // DecodeBatchV2 decodes a batch of transactions from a byte slice.
206
  func DecodeBatchV2(txsData []byte) (*BatchRawV2, error) {
207
  // The transactions is not RLP encoded. Is the raw bytes in this form: 1 byte for the transaction type (always 0b for changeL2Block) + 4 bytes for deltaTimestamp + for bytes for indexL1InfoTree
@@ -223,7 +164,7 @@
223
  // is a tx
224
  default:
225
  if currentBlock == nil {
226
- _, _, err := DecodeTxRLP(txsData, pos)
227
  if err == nil {
228
  // There is no changeL2Block but have a valid RLP transaction
229
  return nil, ErrBatchV2DontStartWithChangeL2Block
@@ -233,7 +174,7 @@
233
  }
234
  }
235
  var tx *L2TxRaw
236
- pos, tx, err = DecodeTxRLP(txsData, pos)
237
  if err != nil {
238
  return nil, fmt.Errorf("can't decode transactions: %w", err)
239
  }
@@ -274,11 +215,11 @@
274
  func decodeBlockHeader(txsData []byte, pos int) (int, *L2BlockRaw, error) {
275
  var err error
276
  currentBlock := &L2BlockRaw{}
277
- pos, currentBlock.DeltaTimestamp, err = decodeUint32(txsData, pos)
278
  if err != nil {
279
  return 0, nil, fmt.Errorf("can't get deltaTimestamp: %w", err)
280
  }
281
- pos, currentBlock.IndexL1InfoTree, err = decodeUint32(txsData, pos)
282
  if err != nil {
283
  return 0, nil, fmt.Errorf("can't get leafIndex: %w", err)
284
  }
@@ -286,8 +227,7 @@
286
  return pos, currentBlock, nil
287
  }
288
 
289
- // DecodeTxRLP decodes a transaction from a byte slice.
290
- func DecodeTxRLP(txsData []byte, offset int) (int, *L2TxRaw, error) {
291
  var err error
292
  length, err := decodeRLPListLengthFromOffset(txsData, offset)
293
  if err != nil {
@@ -325,6 +265,13 @@
325
  return int(endPos), l2Tx, err
326
  }
327
 
 
 
 
 
 
 
 
328
  // It returns the length of data from the param offset
329
  // ex:
330
  // 0xc0 -> empty data -> 1 byte because it include the 0xc0
@@ -355,16 +302,3 @@
355
  }
356
  return length + headerByteLength, nil
357
  }
358
-
359
- func encodeUint32(value uint32) []byte {
360
- data := make([]byte, sizeUInt32)
361
- binary.BigEndian.PutUint32(data, value)
362
- return data
363
- }
364
-
365
- func decodeUint32(txsData []byte, pos int) (int, uint32, error) {
366
- if len(txsData)-pos < sizeUInt32 {
367
- return 0, 0, fmt.Errorf("can't get u32 because not enough data: %w", ErrInvalidBatchV2)
368
- }
369
- return pos + sizeUInt32, binary.BigEndian.Uint32(txsData[pos : pos+sizeUInt32]), nil
370
- }
 
2
  This file provide functions to work with ETROG batches:
3
  - EncodeBatchV2 (equivalent to EncodeTransactions)
4
  - DecodeBatchV2 (equivalent to DecodeTxs)
5
+ - DecodeForcedBatchV2)
 
 
 
 
 
 
6
 
7
 
8
  // batch data format:
 
27
  // 0x00 | 32 | V
28
  // 0x00 | 1 | efficiencyPercentage
29
  // Repeat Transaction
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  */
31
 
32
  package state
33
 
34
  import (
 
35
  "errors"
36
  "fmt"
37
  "strconv"
 
42
  "github.com/ethereum/go-ethereum/rlp"
43
  )
44
 
 
 
 
 
 
 
45
  // L2BlockRaw is the raw representation of a L2 block.
46
  type L2BlockRaw struct {
47
+ DeltaTimestamp uint32
48
+ IndexL1InfoTree uint32
49
+ Transactions []L2TxRaw
50
  }
51
 
52
  // BatchRawV2 is the representation of a batch of transactions.
 
61
 
62
  // L2TxRaw is the raw representation of a L2 transaction inside a L2 block.
63
  type L2TxRaw struct {
64
+ Tx types.Transaction
65
+ EfficiencyPercentage uint8
 
 
66
  }
67
 
68
  const (
69
  changeL2Block = uint8(0x0b)
 
70
  )
71
 
72
  var (
 
92
 
93
  // EncodeBatchV2 encodes a batch of transactions into a byte slice.
94
  func EncodeBatchV2(batch *BatchRawV2) ([]byte, error) {
95
+ var err error
96
+ var batchData []byte
97
  if batch == nil {
98
  return nil, fmt.Errorf("batch is nil: %w", ErrInvalidBatchV2)
99
  }
100
+ blocks := batch.Blocks
101
+ if len(blocks) == 0 {
102
  return nil, fmt.Errorf("a batch need minimum a L2Block: %w", ErrInvalidBatchV2)
103
  }
104
+ for _, block := range blocks {
105
+ batchData, err = EncodeBlockHeaderV2(batchData, block)
 
 
 
106
  if err != nil {
107
+ return nil, fmt.Errorf("can't encode block header: %w", err)
108
  }
109
+ for _, tx := range block.Transactions {
110
+ batchData, err = encodeTxRLP(batchData, tx)
111
+ if err != nil {
112
+ return nil, fmt.Errorf("can't encode tx: %w", err)
113
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  }
115
  }
116
+ return batchData, nil
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  }
118
 
119
+ // EncodeBlockHeaderV2 encodes a batch of l2blocks header into a byte slice.
120
+ func EncodeBlockHeaderV2(batchData []byte, block L2BlockRaw) ([]byte, error) {
121
  batchData = append(batchData, changeL2Block)
122
+ batchData = append(batchData, serializeUint32(block.DeltaTimestamp)...)
123
+ batchData = append(batchData, serializeUint32(block.IndexL1InfoTree)...)
124
+ return batchData, nil
125
  }
126
 
127
+ func encodeTxRLP(batchData []byte, tx L2TxRaw) ([]byte, error) {
128
+ rlpTx, err := prepareRPLTxData(tx.Tx)
129
+ if err != nil {
130
+ return nil, fmt.Errorf("can't encode tx to RLP: %w", err)
 
 
 
 
 
 
131
  }
132
+ batchData = append(batchData, rlpTx...)
133
  batchData = append(batchData, tx.EfficiencyPercentage)
134
  return batchData, nil
135
  }
136
 
137
+ func serializeUint32(value uint32) []byte {
138
+ return []byte{
139
+ byte(value >> 24), // nolint:gomnd
140
+ byte(value >> 16), // nolint:gomnd
141
+ byte(value >> 8), // nolint:gomnd
142
+ byte(value),
143
+ } // nolint:gomnd
144
+ }
145
+
146
  // DecodeBatchV2 decodes a batch of transactions from a byte slice.
147
  func DecodeBatchV2(txsData []byte) (*BatchRawV2, error) {
148
  // The transactions is not RLP encoded. Is the raw bytes in this form: 1 byte for the transaction type (always 0b for changeL2Block) + 4 bytes for deltaTimestamp + for bytes for indexL1InfoTree
 
164
  // is a tx
165
  default:
166
  if currentBlock == nil {
167
+ _, _, err := decodeTxRLP(txsData, pos)
168
  if err == nil {
169
  // There is no changeL2Block but have a valid RLP transaction
170
  return nil, ErrBatchV2DontStartWithChangeL2Block
 
174
  }
175
  }
176
  var tx *L2TxRaw
177
+ pos, tx, err = decodeTxRLP(txsData, pos)
178
  if err != nil {
179
  return nil, fmt.Errorf("can't decode transactions: %w", err)
180
  }
 
215
  func decodeBlockHeader(txsData []byte, pos int) (int, *L2BlockRaw, error) {
216
  var err error
217
  currentBlock := &L2BlockRaw{}
218
+ pos, currentBlock.DeltaTimestamp, err = deserializeUint32(txsData, pos)
219
  if err != nil {
220
  return 0, nil, fmt.Errorf("can't get deltaTimestamp: %w", err)
221
  }
222
+ pos, currentBlock.IndexL1InfoTree, err = deserializeUint32(txsData, pos)
223
  if err != nil {
224
  return 0, nil, fmt.Errorf("can't get leafIndex: %w", err)
225
  }
 
227
  return pos, currentBlock, nil
228
  }
229
 
230
+ func decodeTxRLP(txsData []byte, offset int) (int, *L2TxRaw, error) {
 
231
  var err error
232
  length, err := decodeRLPListLengthFromOffset(txsData, offset)
233
  if err != nil {
 
265
  return int(endPos), l2Tx, err
266
  }
267
 
268
+ func deserializeUint32(txsData []byte, pos int) (int, uint32, error) {
269
+ if len(txsData)-pos < 4 { // nolint:gomnd
270
+ return 0, 0, fmt.Errorf("can't get u32 because not enough data: %w", ErrInvalidBatchV2)
271
+ }
272
+ return pos + 4, uint32(txsData[pos])<<24 | uint32(txsData[pos+1])<<16 | uint32(txsData[pos+2])<<8 | uint32(txsData[pos+3]), nil // nolint:gomnd
273
+ }
274
+
275
  // It returns the length of data from the param offset
276
  // ex:
277
  // 0xc0 -> empty data -> 1 byte because it include the 0xc0
 
302
  }
303
  return length + headerByteLength, nil
304
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/encoding_batch_v2_test.go RENAMED
@@ -186,19 +186,14 @@
186
 
187
  func TestEncodeBatchV2(t *testing.T) {
188
  block1 := L2BlockRaw{
189
- ChangeL2BlockHeader: ChangeL2BlockHeader{
190
- DeltaTimestamp: 123,
191
- IndexL1InfoTree: 456,
192
- },
193
- Transactions: []L2TxRaw{},
194
  }
195
-
196
  block2 := L2BlockRaw{
197
- ChangeL2BlockHeader: ChangeL2BlockHeader{
198
- DeltaTimestamp: 789,
199
- IndexL1InfoTree: 101112,
200
- },
201
- Transactions: []L2TxRaw{},
202
  }
203
  blocks := []L2BlockRaw{block1, block2}
204
 
@@ -244,36 +239,3 @@
244
  _, err = DecodeForcedBatchV2(batchL2Data)
245
  require.Error(t, err)
246
  }
247
-
248
- func TestEncodeBatchV2WithTxInBinary(t *testing.T) {
249
- block1 := L2BlockRaw{
250
- ChangeL2BlockHeader: ChangeL2BlockHeader{
251
- DeltaTimestamp: 123,
252
- IndexL1InfoTree: 456,
253
- },
254
- Transactions: []L2TxRaw{
255
- {
256
- EfficiencyPercentage: 255,
257
- TxAlreadyEncoded: true,
258
- Data: []byte{0x01, 0x02, 0x03},
259
- },
260
- },
261
- }
262
-
263
- block2 := L2BlockRaw{
264
- ChangeL2BlockHeader: ChangeL2BlockHeader{
265
- DeltaTimestamp: 789,
266
- IndexL1InfoTree: 101112,
267
- },
268
- Transactions: []L2TxRaw{},
269
- }
270
- blocks := []L2BlockRaw{block1, block2}
271
-
272
- expectedBatchData := []byte{
273
- 0xb, 0x0, 0x0, 0x0, 0x7b, 0x0, 0x0, 0x1, 0xc8, 0x1, 0x2, 0x3, 0xff, 0xb, 0x0, 0x0, 0x3, 0x15, 0x0, 0x1, 0x8a, 0xf8,
274
- }
275
-
276
- batchData, err := EncodeBatchV2(&BatchRawV2{Blocks: blocks})
277
- require.NoError(t, err)
278
- require.Equal(t, expectedBatchData, batchData)
279
- }
 
186
 
187
  func TestEncodeBatchV2(t *testing.T) {
188
  block1 := L2BlockRaw{
189
+ DeltaTimestamp: 123,
190
+ IndexL1InfoTree: 456,
191
+ Transactions: []L2TxRaw{},
 
 
192
  }
 
193
  block2 := L2BlockRaw{
194
+ DeltaTimestamp: 789,
195
+ IndexL1InfoTree: 101112,
196
+ Transactions: []L2TxRaw{},
 
 
197
  }
198
  blocks := []L2BlockRaw{block1, block2}
199
 
 
239
  _, err = DecodeForcedBatchV2(batchL2Data)
240
  require.Error(t, err)
241
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/genesis.go RENAMED
@@ -19,8 +19,10 @@
19
 
20
  // Genesis contains the information to populate state on creation
21
  type Genesis struct {
22
- // BlockNumber is the block number where the polygonZKEVM smc was deployed on L1
23
- BlockNumber uint64
 
 
24
  // Root hash of the genesis block
25
  Root common.Hash
26
  // Actions is the data to populate into the state trie
@@ -146,7 +148,7 @@
146
  ForcedBatchNum: nil,
147
  }
148
 
149
- err = s.StoreGenesisBatch(ctx, batch, string(SyncGenesisBatchClosingReason), dbTx)
150
  if err != nil {
151
  return common.Hash{}, err
152
  }
 
19
 
20
  // Genesis contains the information to populate state on creation
21
  type Genesis struct {
22
+ // RollupBlockNumber is the block number where the polygonZKEVM smc was deployed on L1
23
+ RollupBlockNumber uint64
24
+ // RollupManagerBlockNumber is the block number where the RollupManager smc was deployed on L1
25
+ RollupManagerBlockNumber uint64
26
  // Root hash of the genesis block
27
  Root common.Hash
28
  // Actions is the data to populate into the state trie
 
148
  ForcedBatchNum: nil,
149
  }
150
 
151
+ err = s.StoreGenesisBatch(ctx, batch, dbTx)
152
  if err != nil {
153
  return common.Hash{}, err
154
  }
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/helper.go RENAMED
@@ -39,7 +39,7 @@
39
  var batchL2Data []byte
40
 
41
  for i, tx := range txs {
42
- txData, err := prepareRLPTxData(tx)
43
  if err != nil {
44
  return nil, err
45
  }
@@ -57,7 +57,7 @@
57
  return batchL2Data, nil
58
  }
59
 
60
- func prepareRLPTxData(tx types.Transaction) ([]byte, error) {
61
  v, r, s := tx.RawSignatureValues()
62
  sign := 1 - (v.Uint64() & 1)
63
 
@@ -99,7 +99,7 @@
99
  var batchL2Data []byte
100
 
101
  for _, tx := range txs {
102
- txData, err := prepareRLPTxData(tx)
103
  if err != nil {
104
  return nil, err
105
  }
 
39
  var batchL2Data []byte
40
 
41
  for i, tx := range txs {
42
+ txData, err := prepareRPLTxData(tx)
43
  if err != nil {
44
  return nil, err
45
  }
 
57
  return batchL2Data, nil
58
  }
59
 
60
+ func prepareRPLTxData(tx types.Transaction) ([]byte, error) {
61
  v, r, s := tx.RawSignatureValues()
62
  sign := 1 - (v.Uint64() & 1)
63
 
 
99
  var batchL2Data []byte
100
 
101
  for _, tx := range txs {
102
+ txData, err := prepareRPLTxData(tx)
103
  if err != nil {
104
  return nil, err
105
  }
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/interfaces.go RENAMED
@@ -15,7 +15,7 @@
15
  Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
16
  QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row
17
  Begin(ctx context.Context) (pgx.Tx, error)
18
- StoreGenesisBatch(ctx context.Context, batch Batch, closingReason string, dbTx pgx.Tx) error
19
  ResetToL1BlockNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) error
20
  ResetForkID(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error
21
  ResetTrustedState(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error
@@ -141,6 +141,7 @@
141
  GetForkIDByBlockNumber(blockNumber uint64) uint64
142
  GetForkIDByBatchNumber(batchNumber uint64) uint64
143
  GetLatestIndex(ctx context.Context, dbTx pgx.Tx) (uint32, error)
 
144
  GetRawBatchTimestamps(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*time.Time, *time.Time, error)
145
  GetL1InfoRootLeafByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx) (L1InfoTreeExitRootStorageEntry, error)
146
  GetL1InfoRootLeafByIndex(ctx context.Context, l1InfoTreeIndex uint32, dbTx pgx.Tx) (L1InfoTreeExitRootStorageEntry, error)
@@ -148,6 +149,7 @@
148
  GetBlockByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*Block, error)
149
  GetVirtualBatchParentHash(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (common.Hash, error)
150
  GetForcedBatchParentHash(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) (common.Hash, error)
 
151
  GetLatestBatchGlobalExitRoot(ctx context.Context, dbTx pgx.Tx) (common.Hash, error)
152
  GetL2TxHashByTxHash(ctx context.Context, hash common.Hash, dbTx pgx.Tx) (*common.Hash, error)
153
  GetSyncInfoData(ctx context.Context, dbTx pgx.Tx) (SyncInfoDataOnStorage, error)
 
15
  Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
16
  QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row
17
  Begin(ctx context.Context) (pgx.Tx, error)
18
+ StoreGenesisBatch(ctx context.Context, batch Batch, dbTx pgx.Tx) error
19
  ResetToL1BlockNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) error
20
  ResetForkID(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error
21
  ResetTrustedState(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error
 
141
  GetForkIDByBlockNumber(blockNumber uint64) uint64
142
  GetForkIDByBatchNumber(batchNumber uint64) uint64
143
  GetLatestIndex(ctx context.Context, dbTx pgx.Tx) (uint32, error)
144
+ BuildChangeL2Block(deltaTimestamp uint32, l1InfoTreeIndex uint32) []byte
145
  GetRawBatchTimestamps(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*time.Time, *time.Time, error)
146
  GetL1InfoRootLeafByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash, dbTx pgx.Tx) (L1InfoTreeExitRootStorageEntry, error)
147
  GetL1InfoRootLeafByIndex(ctx context.Context, l1InfoTreeIndex uint32, dbTx pgx.Tx) (L1InfoTreeExitRootStorageEntry, error)
 
149
  GetBlockByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*Block, error)
150
  GetVirtualBatchParentHash(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (common.Hash, error)
151
  GetForcedBatchParentHash(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) (common.Hash, error)
152
+ GetBatchL2DataByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) ([]byte, error)
153
  GetLatestBatchGlobalExitRoot(ctx context.Context, dbTx pgx.Tx) (common.Hash, error)
154
  GetL2TxHashByTxHash(ctx context.Context, hash common.Hash, dbTx pgx.Tx) (*common.Hash, error)
155
  GetSyncInfoData(ctx context.Context, dbTx pgx.Tx) (SyncInfoDataOnStorage, error)
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/batch.go RENAMED
@@ -2,6 +2,7 @@
2
 
3
  import (
4
  "context"
 
5
  "encoding/json"
6
  "errors"
7
  "fmt"
@@ -557,8 +558,8 @@
557
  return &virtualBatch, nil
558
  }
559
 
560
- func (p *PostgresStorage) StoreGenesisBatch(ctx context.Context, batch state.Batch, closingReason string, dbTx pgx.Tx) error {
561
- const addGenesisBatchSQL = "INSERT INTO state.batch (batch_num, global_exit_root, local_exit_root, acc_input_hash, state_root, timestamp, coinbase, raw_txs_data, forced_batch_num,closing_reason, wip) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9,$10, FALSE)"
562
 
563
  if batch.BatchNumber != 0 {
564
  return fmt.Errorf("%w. Got %d, should be 0", state.ErrUnexpectedBatch, batch.BatchNumber)
@@ -576,7 +577,6 @@
576
  batch.Coinbase.String(),
577
  batch.BatchL2Data,
578
  batch.ForcedBatchNum,
579
- closingReason,
580
  )
581
 
582
  return err
@@ -956,6 +956,25 @@
956
  return blockNum, nil
957
  }
958
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
959
  // GetRawBatchTimestamps returns the timestamp of the batch with the given number.
960
  // it returns batch_num.tstamp and virtual_batch.batch_timestamp
961
  func (p *PostgresStorage) GetRawBatchTimestamps(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*time.Time, *time.Time, error) {
 
2
 
3
  import (
4
  "context"
5
+ "encoding/binary"
6
  "encoding/json"
7
  "errors"
8
  "fmt"
 
558
  return &virtualBatch, nil
559
  }
560
 
561
+ func (p *PostgresStorage) StoreGenesisBatch(ctx context.Context, batch state.Batch, dbTx pgx.Tx) error {
562
+ const addGenesisBatchSQL = "INSERT INTO state.batch (batch_num, global_exit_root, local_exit_root, acc_input_hash, state_root, timestamp, coinbase, raw_txs_data, forced_batch_num, wip) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, FALSE)"
563
 
564
  if batch.BatchNumber != 0 {
565
  return fmt.Errorf("%w. Got %d, should be 0", state.ErrUnexpectedBatch, batch.BatchNumber)
 
577
  batch.Coinbase.String(),
578
  batch.BatchL2Data,
579
  batch.ForcedBatchNum,
 
580
  )
581
 
582
  return err
 
956
  return blockNum, nil
957
  }
958
 
959
+ // BuildChangeL2Block returns a changeL2Block tx to use in the BatchL2Data
960
+ func (p *PostgresStorage) BuildChangeL2Block(deltaTimestamp uint32, l1InfoTreeIndex uint32) []byte {
961
+ changeL2BlockMark := []byte{0x0B}
962
+ changeL2Block := []byte{}
963
+
964
+ // changeL2Block transaction mark
965
+ changeL2Block = append(changeL2Block, changeL2BlockMark...)
966
+ // changeL2Block deltaTimeStamp
967
+ deltaTimestampBytes := make([]byte, 4) //nolint:gomnd
968
+ binary.BigEndian.PutUint32(deltaTimestampBytes, deltaTimestamp)
969
+ changeL2Block = append(changeL2Block, deltaTimestampBytes...)
970
+ // changeL2Block l1InfoTreeIndexBytes
971
+ l1InfoTreeIndexBytes := make([]byte, 4) //nolint:gomnd
972
+ binary.BigEndian.PutUint32(l1InfoTreeIndexBytes, l1InfoTreeIndex)
973
+ changeL2Block = append(changeL2Block, l1InfoTreeIndexBytes...)
974
+
975
+ return changeL2Block
976
+ }
977
+
978
  // GetRawBatchTimestamps returns the timestamp of the batch with the given number.
979
  // it returns batch_num.tstamp and virtual_batch.batch_timestamp
980
  func (p *PostgresStorage) GetRawBatchTimestamps(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*time.Time, *time.Time, error) {
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/pgstatestorage.go RENAMED
@@ -355,3 +355,18 @@
355
  }
356
  return nativeBlockHashes, nil
357
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
355
  }
356
  return nativeBlockHashes, nil
357
  }
358
+
359
+ // GetBatchL2DataByNumber returns the batch L2 data of the given batch number.
360
+ func (p *PostgresStorage) GetBatchL2DataByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) ([]byte, error) {
361
+ const getBatchL2DataByBatchNumber = "SELECT raw_txs_data FROM state.batch WHERE batch_num = $1"
362
+ q := p.getExecQuerier(dbTx)
363
+ var batchL2Data []byte
364
+ err := q.QueryRow(ctx, getBatchL2DataByBatchNumber, batchNumber).Scan(&batchL2Data)
365
+
366
+ if errors.Is(err, pgx.ErrNoRows) {
367
+ return nil, state.ErrNotFound
368
+ } else if err != nil {
369
+ return nil, err
370
+ }
371
+ return batchL2Data, nil
372
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/pgstatestorage/pgstatestorage_test.go RENAMED
@@ -1129,6 +1129,33 @@
1129
  require.NoError(t, dbTx.Commit(ctx))
1130
  }
1131
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1132
  func createL1InfoTreeExitRootStorageEntryForTest(blockNumber uint64, index uint32) *state.L1InfoTreeExitRootStorageEntry {
1133
  exitRoot := state.L1InfoTreeExitRootStorageEntry{
1134
  L1InfoTreeLeaf: state.L1InfoTreeLeaf{
@@ -1406,5 +1433,4 @@
1406
  ger, err = testState.GetLatestBatchGlobalExitRoot(ctx, dbTx)
1407
  require.NoError(t, err)
1408
  require.Equal(t, common.HexToHash("0x2").String(), ger.String())
1409
-
1410
  }
 
1129
  require.NoError(t, dbTx.Commit(ctx))
1130
  }
1131
 
1132
+ func TestGetBatchL2DataByNumber(t *testing.T) {
1133
+ // Init database instance
1134
+ initOrResetDB()
1135
+ ctx := context.Background()
1136
+ tx, err := testState.BeginStateTransaction(ctx)
1137
+ require.NoError(t, err)
1138
+ defer func() { require.NoError(t, tx.Commit(ctx)) }()
1139
+
1140
+ // empty case
1141
+ var batchNum uint64 = 4
1142
+ const openBatchSQL = "INSERT INTO state.batch (batch_num, raw_txs_data, wip) VALUES ($1, $2, false)"
1143
+ _, err = tx.Exec(ctx, openBatchSQL, batchNum, nil)
1144
+ require.NoError(t, err)
1145
+ data, err := testState.GetBatchL2DataByNumber(ctx, batchNum, tx)
1146
+ require.NoError(t, err)
1147
+ assert.Nil(t, data)
1148
+
1149
+ // not empty case
1150
+ expectedData := []byte("foo bar")
1151
+ batchNum = 5
1152
+ _, err = tx.Exec(ctx, openBatchSQL, batchNum, expectedData)
1153
+ require.NoError(t, err)
1154
+ actualData, err := testState.GetBatchL2DataByNumber(ctx, batchNum, tx)
1155
+ require.NoError(t, err)
1156
+ assert.Equal(t, expectedData, actualData)
1157
+ }
1158
+
1159
  func createL1InfoTreeExitRootStorageEntryForTest(blockNumber uint64, index uint32) *state.L1InfoTreeExitRootStorageEntry {
1160
  exitRoot := state.L1InfoTreeExitRootStorageEntry{
1161
  L1InfoTreeLeaf: state.L1InfoTreeLeaf{
 
1433
  ger, err = testState.GetLatestBatchGlobalExitRoot(ctx, dbTx)
1434
  require.NoError(t, err)
1435
  require.Equal(t, common.HexToHash("0x2").String(), ger.String())
 
1436
  }
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/runtime/executor/client.go RENAMED
@@ -10,6 +10,13 @@
10
  "google.golang.org/grpc/credentials/insecure"
11
  )
12
 
 
 
 
 
 
 
 
13
  // NewExecutorClient is the executor client constructor.
14
  func NewExecutorClient(ctx context.Context, c Config) (ExecutorServiceClient, *grpc.ClientConn, context.CancelFunc) {
15
  opts := []grpc.DialOption{
 
10
  "google.golang.org/grpc/credentials/insecure"
11
  )
12
 
13
+ const (
14
+ // ExecutionMode0 is the execution mode for the sequencer and RPC, default one
15
+ ExecutionMode0 = uint64(0)
16
+ // ExecutionMode1 is the execution mode for the synchronizer
17
+ ExecutionMode1 = uint64(1)
18
+ )
19
+
20
  // NewExecutorClient is the executor client constructor.
21
  func NewExecutorClient(ctx context.Context, c Config) (ExecutorServiceClient, *grpc.ClientConn, context.CancelFunc) {
22
  opts := []grpc.DialOption{
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/test/forkid_etrog/etrog_test.go RENAMED
@@ -98,11 +98,9 @@
98
  if len(txs) > 0 {
99
  // Generate batchdata from the txs in the test and compared with the vector
100
  l2block := state.L2BlockRaw{
101
- ChangeL2BlockHeader: state.ChangeL2BlockHeader{
102
- DeltaTimestamp: uint32(timestampLimit.Uint64()),
103
- IndexL1InfoTree: testCase.Txs[0].IndexL1InfoTree,
104
- },
105
- Transactions: txs,
106
  }
107
 
108
  batch := state.BatchRawV2{
 
98
  if len(txs) > 0 {
99
  // Generate batchdata from the txs in the test and compared with the vector
100
  l2block := state.L2BlockRaw{
101
+ DeltaTimestamp: uint32(timestampLimit.Uint64()),
102
+ IndexL1InfoTree: testCase.Txs[0].IndexL1InfoTree,
103
+ Transactions: txs,
 
 
104
  }
105
 
106
  batch := state.BatchRawV2{
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/trace.go RENAMED
@@ -242,6 +242,7 @@
242
  TimestampLimit: uint64(time.Now().Unix()),
243
  SkipFirstChangeL2Block: cFalse,
244
  SkipWriteBlockInfoRoot: cTrue,
 
245
  }
246
 
247
  // gets the L1InfoTreeData for the transactions
 
242
  TimestampLimit: uint64(time.Now().Unix()),
243
  SkipFirstChangeL2Block: cFalse,
244
  SkipWriteBlockInfoRoot: cTrue,
245
+ ExecutionMode: executor.ExecutionMode0,
246
  }
247
 
248
  // gets the L1InfoTreeData for the transactions
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/transaction.go RENAMED
@@ -529,6 +529,7 @@
529
  TimestampLimit: uint64(time.Now().Unix()),
530
  SkipFirstChangeL2Block: cFalse,
531
  SkipWriteBlockInfoRoot: cTrue,
 
532
  }
533
  if noZKEVMCounters {
534
  processBatchRequestV2.NoCounters = cTrue
@@ -603,6 +604,17 @@
603
 
604
  if processBatchResponseV2.ErrorRom != executor.RomError_ROM_ERROR_NO_ERROR {
605
  err = executor.RomErr(processBatchResponseV2.ErrorRom)
 
 
 
 
 
 
 
 
 
 
 
606
  if executor.IsROMOutOfCountersError(executor.RomErrorCode(err)) {
607
  return response, err
608
  }
@@ -1003,6 +1015,7 @@
1003
  TimestampLimit: uint64(time.Now().Unix()),
1004
  SkipFirstChangeL2Block: cTrue,
1005
  SkipWriteBlockInfoRoot: cTrue,
 
1006
  }
1007
 
1008
  log.Debugf("EstimateGas[processBatchRequestV2.From]: %v", processBatchRequestV2.From)
 
529
  TimestampLimit: uint64(time.Now().Unix()),
530
  SkipFirstChangeL2Block: cFalse,
531
  SkipWriteBlockInfoRoot: cTrue,
532
+ ExecutionMode: executor.ExecutionMode0,
533
  }
534
  if noZKEVMCounters {
535
  processBatchRequestV2.NoCounters = cTrue
 
604
 
605
  if processBatchResponseV2.ErrorRom != executor.RomError_ROM_ERROR_NO_ERROR {
606
  err = executor.RomErr(processBatchResponseV2.ErrorRom)
607
+ s.eventLog.LogExecutorErrorV2(ctx, processBatchResponseV2.Error, processBatchRequestV2)
608
+ if executor.IsROMOutOfCountersError(executor.RomErrorCode(err)) {
609
+ return response, err
610
+ }
611
+
612
+ return nil, err
613
+ }
614
+
615
+ if processBatchResponseV2.ErrorRom != executor.RomError_ROM_ERROR_NO_ERROR {
616
+ err = executor.RomErr(processBatchResponseV2.ErrorRom)
617
+ s.eventLog.LogExecutorErrorV2(ctx, processBatchResponseV2.Error, processBatchRequestV2)
618
  if executor.IsROMOutOfCountersError(executor.RomErrorCode(err)) {
619
  return response, err
620
  }
 
1015
  TimestampLimit: uint64(time.Now().Unix()),
1016
  SkipFirstChangeL2Block: cTrue,
1017
  SkipWriteBlockInfoRoot: cTrue,
1018
+ ExecutionMode: executor.ExecutionMode0,
1019
  }
1020
 
1021
  log.Debugf("EstimateGas[processBatchRequestV2.From]: %v", processBatchRequestV2.From)
{/home/stefan/go/src/Polygon/zkevm-node → .}/state/types.go RENAMED
@@ -31,6 +31,7 @@
31
  SkipWriteBlockInfoRoot_V2 bool
32
  SkipVerifyL1InfoRoot_V2 bool
33
  ForkID uint64
 
34
  }
35
 
36
  // L1DataV2 represents the L1InfoTree data used in ProcessRequest.L1InfoTreeData_V2 parameter
@@ -65,6 +66,7 @@
65
  ForkID uint64
66
  InvalidBatch_V2 bool
67
  RomError_V2 error
 
68
  }
69
 
70
  // ProcessBlockResponse represents the response of a block
 
31
  SkipWriteBlockInfoRoot_V2 bool
32
  SkipVerifyL1InfoRoot_V2 bool
33
  ForkID uint64
34
+ ExecutionMode uint64
35
  }
36
 
37
  // L1DataV2 represents the L1InfoTree data used in ProcessRequest.L1InfoTreeData_V2 parameter
 
66
  ForkID uint64
67
  InvalidBatch_V2 bool
68
  RomError_V2 error
69
+ CloseBatch_V2 bool
70
  }
71
 
72
  // ProcessBlockResponse represents the response of a block
{/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/etrog/processor_l1_sequence_batches.go RENAMED
@@ -156,7 +156,7 @@
156
  BatchL2Data: &txs,
157
  ForcedBlockHashL1: forcedBlockHashL1,
158
  SkipVerifyL1InfoRoot: 1,
159
- ClosingReason: state.SyncL1EventSequencedForcedBatchClosingReason,
160
  }
161
  } else if sbatch.PolygonRollupBaseEtrogBatchData.ForcedTimestamp > 0 && sbatch.BatchNumber == 1 {
162
  log.Debug("Processing initial batch")
@@ -173,7 +173,7 @@
173
  BatchL2Data: &txs,
174
  ForcedBlockHashL1: forcedBlockHashL1,
175
  SkipVerifyL1InfoRoot: 1,
176
- ClosingReason: state.SyncL1EventInitialBatchClosingReason,
177
  }
178
  } else {
179
  var maxGER common.Hash
@@ -198,7 +198,7 @@
198
  BatchL2Data: &batch.BatchL2Data,
199
  SkipVerifyL1InfoRoot: 1,
200
  GlobalExitRoot: batch.GlobalExitRoot,
201
- ClosingReason: state.SyncL1EventSequencedBatchClosingReason,
202
  }
203
  if batch.GlobalExitRoot == (common.Hash{}) {
204
  if len(leaves) > 0 {
 
156
  BatchL2Data: &txs,
157
  ForcedBlockHashL1: forcedBlockHashL1,
158
  SkipVerifyL1InfoRoot: 1,
159
+ ExecutionMode: executor.ExecutionMode1,
160
  }
161
  } else if sbatch.PolygonRollupBaseEtrogBatchData.ForcedTimestamp > 0 && sbatch.BatchNumber == 1 {
162
  log.Debug("Processing initial batch")
 
173
  BatchL2Data: &txs,
174
  ForcedBlockHashL1: forcedBlockHashL1,
175
  SkipVerifyL1InfoRoot: 1,
176
+ ExecutionMode: executor.ExecutionMode1,
177
  }
178
  } else {
179
  var maxGER common.Hash
 
198
  BatchL2Data: &batch.BatchL2Data,
199
  SkipVerifyL1InfoRoot: 1,
200
  GlobalExitRoot: batch.GlobalExitRoot,
201
+ ExecutionMode: executor.ExecutionMode1,
202
  }
203
  if batch.GlobalExitRoot == (common.Hash{}) {
204
  if len(leaves) > 0 {
{/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/actions/etrog/processor_l1_update_etrog_sequence.go RENAMED
@@ -83,7 +84,7 @@
83
  ForcedBlockHashL1: forcedBlockHashL1,
84
  SkipVerifyL1InfoRoot: 1,
85
  GlobalExitRoot: updateEtrogSequence.PolygonRollupBaseEtrogBatchData.ForcedGlobalExitRoot,
86
- ClosingReason: state.SyncL1EventUpdateEtrogSequenceClosingReason,
87
  }
88
 
89
  virtualBatch := state.VirtualBatch{
 
84
  ForcedBlockHashL1: forcedBlockHashL1,
85
  SkipVerifyL1InfoRoot: 1,
86
  GlobalExitRoot: updateEtrogSequence.PolygonRollupBaseEtrogBatchData.ForcedGlobalExitRoot,
87
+ ExecutionMode: executor.ExecutionMode1,
88
  }
89
 
90
  virtualBatch := state.VirtualBatch{
{/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/config.go RENAMED
@@ -20,8 +19,6 @@
20
  L1SynchronizationMode string `jsonschema:"enum=sequential,enum=parallel"`
21
  // L1ParallelSynchronization Configuration for parallel mode (if L1SynchronizationMode equal to 'parallel')
22
  L1ParallelSynchronization L1ParallelSynchronizationConfig
23
- // L2Synchronization Configuration for L2 synchronization
24
- L2Synchronization l2_sync.Config `mapstructure:"L2Synchronization"`
25
  }
26
 
27
  // L1ParallelSynchronizationConfig Configuration for parallel mode (if UL1SynchronizationMode equal to 'parallel')
 
19
  L1SynchronizationMode string `jsonschema:"enum=sequential,enum=parallel"`
20
  // L1ParallelSynchronization Configuration for parallel mode (if L1SynchronizationMode equal to 'parallel')
21
  L1ParallelSynchronization L1ParallelSynchronizationConfig
 
 
22
  }
23
 
24
  // L1ParallelSynchronizationConfig Configuration for parallel mode (if UL1SynchronizationMode equal to 'parallel')
{/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l1_parallel_sync/l1_worker_etherman_test.go RENAMED
@@ -31,7 +31,7 @@
31
  GlobalExitRootManagerAddr: common.HexToAddress("0x8A791620dd6260079BF849Dc5567aDC3F2FdC318"),
32
  }
33
 
34
- ethermanClient, err := etherman.NewClient(cfg, l1Config)
35
  require.NoError(t, err)
36
  worker := newWorker(ethermanClient)
37
  ch := make(chan responseRollupInfoByBlockRange)
 
31
  GlobalExitRootManagerAddr: common.HexToAddress("0x8A791620dd6260079BF849Dc5567aDC3F2FdC318"),
32
  }
33
 
34
+ ethermanClient, err := etherman.NewClient(cfg, l1Config, nil)
35
  require.NoError(t, err)
36
  worker := newWorker(ethermanClient)
37
  ch := make(chan responseRollupInfoByBlockRange)
{/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/config.go RENAMED
@@ -1,8 +0,0 @@
1
- package l2_sync
2
-
3
- // Config configuration of L2 sync process
4
- type Config struct {
5
- // AcceptEmptyClosedBatches is a flag to enable or disable the acceptance of empty batches.
6
- // if true, the synchronizer will accept empty batches and process them.
7
- AcceptEmptyClosedBatches bool `mapstructure:"AcceptEmptyClosedBatches"`
8
- }
 
 
 
 
 
 
 
 
 
{/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/l2_shared/processor_trusted_batch_sync.go RENAMED
@@ -125,6 +124,8 @@
125
  ReProcess(ctx context.Context, data *ProcessData, dbTx pgx.Tx) (*ProcessResponse, error)
126
  // NothingProcess process a batch that is already synchronized, so we don't need to process it
127
  NothingProcess(ctx context.Context, data *ProcessData, dbTx pgx.Tx) (*ProcessResponse, error)
 
 
128
  }
129
 
130
  // ProcessorTrustedBatchSync is a template to sync trusted state. It classify what kind of update is needed and call to SyncTrustedStateBatchExecutorSteps
@@ -135,16 +136,14 @@
135
  type ProcessorTrustedBatchSync struct {
136
  Steps SyncTrustedBatchExecutor
137
  timeProvider syncCommon.TimeProvider
138
- Cfg l2_sync.Config
139
  }
140
 
141
  // NewProcessorTrustedBatchSync creates a new SyncTrustedStateBatchExecutorTemplate
142
  func NewProcessorTrustedBatchSync(steps SyncTrustedBatchExecutor,
143
- timeProvider syncCommon.TimeProvider, cfg l2_sync.Config) *ProcessorTrustedBatchSync {
144
  return &ProcessorTrustedBatchSync{
145
  Steps: steps,
146
  timeProvider: timeProvider,
147
- Cfg: cfg,
148
  }
149
  }
150
 
@@ -266,7 +265,7 @@
266
  return ProcessData{}, fmt.Errorf("trustedNodeBatch and statePreviousBatch can't be nil")
267
  }
268
 
269
- var result ProcessData = ProcessData{}
270
  if stateBatch == nil {
271
  result = ProcessData{
272
  Mode: FullProcessMode,
@@ -309,11 +308,9 @@
309
  }
310
  }
311
  }
312
-
313
  if result.Mode == "" {
314
- return result, fmt.Errorf("batch %v: failed to get mode for process ", trustedNodeBatch.Number)
315
  }
316
-
317
  result.BatchNumber = uint64(trustedNodeBatch.Number)
318
  result.StateBatch = stateBatch
319
  result.TrustedBatch = trustedNodeBatch
@@ -321,17 +318,6 @@
321
  result.OldAccInputHash = statePreviousBatch.AccInputHash
322
  result.Now = s.timeProvider.Now()
323
  result.DebugPrefix = fmt.Sprintf("%s mode %s:", debugPrefix, result.Mode)
324
-
325
- if isTrustedBatchEmptyAndClosed(trustedNodeBatch) {
326
- if s.Cfg.AcceptEmptyClosedBatches {
327
- log.Infof("%s Batch %v: TrustedBatch Empty and closed, accepted due configuration", result.DebugPrefix, trustedNodeBatch.Number)
328
- } else {
329
- err := fmt.Errorf("%s Batch %v: TrustedBatch Empty and closed, rejected due configuration", result.DebugPrefix, trustedNodeBatch.Number)
330
- log.Infof(err.Error())
331
- return result, err
332
- }
333
- }
334
-
335
  return result, nil
336
  }
337
 
@@ -339,10 +325,6 @@
339
  return batch.Closed
340
  }
341
 
342
- func isTrustedBatchEmptyAndClosed(batch *types.Batch) bool {
343
- return len(batch.BatchL2Data) == 0 && isTrustedBatchClosed(batch)
344
- }
345
-
346
  func checkStateRootAndLER(batchNumber uint64, expectedStateRoot common.Hash, expectedLER common.Hash, calculatedStateRoot common.Hash, calculatedLER common.Hash) error {
347
  if calculatedStateRoot != expectedStateRoot {
348
  return fmt.Errorf("batch %v: stareRoot calculated [%s] is different from the one in the batch [%s] err:%w", batchNumber, calculatedStateRoot, expectedStateRoot, ErrFatalBatchDesynchronized)
@@ -357,13 +339,7 @@
357
  var err error = nil
358
  var trustedBatch = data.TrustedBatch
359
  if trustedBatch == nil {
360
- err = fmt.Errorf("%s trustedBatch is nil, it never should be nil", data.DebugPrefix)
361
- log.Error(err.Error())
362
- return err
363
- }
364
- if len(trustedBatch.BatchL2Data) == 0 {
365
- log.Warnf("Batch %v: BatchL2Data is empty, no checking", trustedBatch.Number)
366
- return nil
367
  }
368
  if processBatchResp == nil {
369
  log.Warnf("Batch %v: Can't check processBatchResp because is nil, then check store batch in DB", trustedBatch.Number)
 
124
  ReProcess(ctx context.Context, data *ProcessData, dbTx pgx.Tx) (*ProcessResponse, error)
125
  // NothingProcess process a batch that is already synchronized, so we don't need to process it
126
  NothingProcess(ctx context.Context, data *ProcessData, dbTx pgx.Tx) (*ProcessResponse, error)
127
+ // CloseBatch close a batch
128
+ //CloseBatch(ctx context.Context, trustedBatch *types.Batch, dbTx pgx.Tx) error
129
  }
130
 
131
  // ProcessorTrustedBatchSync is a template to sync trusted state. It classify what kind of update is needed and call to SyncTrustedStateBatchExecutorSteps
 
136
  type ProcessorTrustedBatchSync struct {
137
  Steps SyncTrustedBatchExecutor
138
  timeProvider syncCommon.TimeProvider
 
139
  }
140
 
141
  // NewProcessorTrustedBatchSync creates a new SyncTrustedStateBatchExecutorTemplate
142
  func NewProcessorTrustedBatchSync(steps SyncTrustedBatchExecutor,
143
+ timeProvider syncCommon.TimeProvider) *ProcessorTrustedBatchSync {
144
  return &ProcessorTrustedBatchSync{
145
  Steps: steps,
146
  timeProvider: timeProvider,
 
147
  }
148
  }
149
 
 
265
  return ProcessData{}, fmt.Errorf("trustedNodeBatch and statePreviousBatch can't be nil")
266
  }
267
 
268
+ var result ProcessData
269
  if stateBatch == nil {
270
  result = ProcessData{
271
  Mode: FullProcessMode,
 
308
  }
309
  }
310
  }
 
311
  if result.Mode == "" {
312
+ return result, fmt.Errorf("failed to get mode for process batch %v", trustedNodeBatch.Number)
313
  }
 
314
  result.BatchNumber = uint64(trustedNodeBatch.Number)
315
  result.StateBatch = stateBatch
316
  result.TrustedBatch = trustedNodeBatch
 
318
  result.OldAccInputHash = statePreviousBatch.AccInputHash
319
  result.Now = s.timeProvider.Now()
320
  result.DebugPrefix = fmt.Sprintf("%s mode %s:", debugPrefix, result.Mode)
 
 
 
 
 
 
 
 
 
 
 
321
  return result, nil
322
  }
323
 
 
325
  return batch.Closed
326
  }
327
 
 
 
 
 
328
  func checkStateRootAndLER(batchNumber uint64, expectedStateRoot common.Hash, expectedLER common.Hash, calculatedStateRoot common.Hash, calculatedLER common.Hash) error {
329
  if calculatedStateRoot != expectedStateRoot {
330
  return fmt.Errorf("batch %v: stareRoot calculated [%s] is different from the one in the batch [%s] err:%w", batchNumber, calculatedStateRoot, expectedStateRoot, ErrFatalBatchDesynchronized)
 
339
  var err error = nil
340
  var trustedBatch = data.TrustedBatch
341
  if trustedBatch == nil {
342
+ panic("trustedBatch is nil")
 
 
 
 
 
 
343
  }
344
  if processBatchResp == nil {
345
  log.Warnf("Batch %v: Can't check processBatchResp because is nil, then check store batch in DB", trustedBatch.Number)
{/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/l2_shared/tests/processor_trusted_batch_sync_test.go RENAMED
@@ -19,15 +18,12 @@
19
  var (
20
  hash1 = common.HexToHash("0x29e885edaf8e4b51e1d2e05f9da28161d2fb4f6b1d53827d9b80a23cf2d7d9f1")
21
  hash2 = common.HexToHash("0x979b141b8bcd3ba17815cd76811f1fca1cabaa9d51f7c00712606970f81d6e37")
22
- cfg = l2_sync.Config{
23
- AcceptEmptyClosedBatches: true,
24
- }
25
  )
26
 
27
  func TestCacheEmpty(t *testing.T) {
28
  mockExecutor := mock_l2_shared.NewSyncTrustedBatchExecutor(t)
29
  mockTimer := &commonSync.MockTimerProvider{}
30
- sut := l2_shared.NewProcessorTrustedBatchSync(mockExecutor, mockTimer, cfg)
31
 
32
  current, previous := sut.GetCurrentAndPreviousBatchFromCache(&l2_shared.TrustedState{
33
  LastTrustedBatches: []*state.Batch{nil, nil},
@@ -57,7 +53,7 @@
57
  status := l2_shared.TrustedState{
58
  LastTrustedBatches: []*state.Batch{&batchA},
59
  }
60
- sut := l2_shared.NewProcessorTrustedBatchSync(mockExecutor, mockTimer, cfg)
61
 
62
  current, previous := sut.GetCurrentAndPreviousBatchFromCache(&status)
63
  require.Nil(t, previous)
@@ -75,7 +71,7 @@
75
  status := l2_shared.TrustedState{
76
  LastTrustedBatches: []*state.Batch{nil, &batchA},
77
  }
78
- sut := l2_shared.NewProcessorTrustedBatchSync(mockExecutor, mockTimer, cfg)
79
 
80
  current, previous := sut.GetCurrentAndPreviousBatchFromCache(&status)
81
  require.Nil(t, current)
@@ -98,7 +94,7 @@
98
  return &TestDataForProcessorTrustedBatchSync{
99
  mockTimer: mockTimer,
100
  mockExecutor: mockExecutor,
101
- sut: l2_shared.NewProcessorTrustedBatchSync(mockExecutor, mockTimer, cfg),
102
  stateCurrentBatch: &state.Batch{
103
  BatchNumber: 123,
104
  Coinbase: common.HexToAddress("0x1230"),
@@ -191,54 +187,6 @@
191
  require.NoError(t, err)
192
  require.Equal(t, l2_shared.NothingProcessMode, processData.Mode, "current batch and trusted batch are the same, just need to be closed")
193
  require.Equal(t, false, processData.BatchMustBeClosed, "nothing to do")
194
-
195
- testData.stateCurrentBatch.WIP = false
196
- testData.trustedNodeBatch.Closed = false
197
- processData, err = testData.sut.GetModeForProcessBatch(testData.trustedNodeBatch, nil, testData.statePreviousBatch, "test")
198
- require.NoError(t, err)
199
- require.Equal(t, l2_shared.FullProcessMode, processData.Mode, "no batch in DB, fullprocess")
200
- require.Equal(t, false, processData.BatchMustBeClosed, "nothing to do")
201
-
202
- testData.stateCurrentBatch.WIP = false
203
- testData.trustedNodeBatch.Closed = true
204
- processData, err = testData.sut.GetModeForProcessBatch(testData.trustedNodeBatch, nil, testData.statePreviousBatch, "test")
205
- require.NoError(t, err)
206
- require.Equal(t, l2_shared.FullProcessMode, processData.Mode, "no batch in DB, fullprocess")
207
- require.Equal(t, true, processData.BatchMustBeClosed, "must be close")
208
-
209
- }
210
-
211
- func TestGetModeForEmptyAndClosedBatchConfiguredToReject(t *testing.T) {
212
- testData := newTestDataForProcessorTrustedBatchSync(t)
213
- testData.sut.Cfg.AcceptEmptyClosedBatches = false
214
- testData.stateCurrentBatch.WIP = true
215
- testData.trustedNodeBatch.Closed = true
216
- processData, err := testData.sut.GetModeForProcessBatch(testData.trustedNodeBatch, testData.stateCurrentBatch, testData.statePreviousBatch, "test")
217
- require.Error(t, err)
218
-
219
- testData.stateCurrentBatch.WIP = false
220
- testData.trustedNodeBatch.Closed = true
221
- processData, err = testData.sut.GetModeForProcessBatch(testData.trustedNodeBatch, testData.stateCurrentBatch, testData.statePreviousBatch, "test")
222
- require.Error(t, err)
223
-
224
- testData.stateCurrentBatch.WIP = false
225
- testData.trustedNodeBatch.Closed = false
226
- processData, err = testData.sut.GetModeForProcessBatch(testData.trustedNodeBatch, testData.stateCurrentBatch, testData.statePreviousBatch, "test")
227
- require.NoError(t, err)
228
- require.Equal(t, l2_shared.NothingProcessMode, processData.Mode, "current batch and trusted batch are the same, just need to be closed")
229
- require.Equal(t, false, processData.BatchMustBeClosed, "nothing to do")
230
-
231
- testData.stateCurrentBatch.WIP = false
232
- testData.trustedNodeBatch.Closed = false
233
- processData, err = testData.sut.GetModeForProcessBatch(testData.trustedNodeBatch, nil, testData.statePreviousBatch, "test")
234
- require.NoError(t, err)
235
- require.Equal(t, l2_shared.FullProcessMode, processData.Mode, "current batch and trusted batch are the same, just need to be closed")
236
- require.Equal(t, false, processData.BatchMustBeClosed, "nothing to do")
237
-
238
- testData.stateCurrentBatch.WIP = false
239
- testData.trustedNodeBatch.Closed = true
240
- processData, err = testData.sut.GetModeForProcessBatch(testData.trustedNodeBatch, nil, testData.statePreviousBatch, "test")
241
- require.Error(t, err)
242
  }
243
 
244
  func TestGetNextStatusClear(t *testing.T) {
 
18
  var (
19
  hash1 = common.HexToHash("0x29e885edaf8e4b51e1d2e05f9da28161d2fb4f6b1d53827d9b80a23cf2d7d9f1")
20
  hash2 = common.HexToHash("0x979b141b8bcd3ba17815cd76811f1fca1cabaa9d51f7c00712606970f81d6e37")
 
 
 
21
  )
22
 
23
  func TestCacheEmpty(t *testing.T) {
24
  mockExecutor := mock_l2_shared.NewSyncTrustedBatchExecutor(t)
25
  mockTimer := &commonSync.MockTimerProvider{}
26
+ sut := l2_shared.NewProcessorTrustedBatchSync(mockExecutor, mockTimer)
27
 
28
  current, previous := sut.GetCurrentAndPreviousBatchFromCache(&l2_shared.TrustedState{
29
  LastTrustedBatches: []*state.Batch{nil, nil},
 
53
  status := l2_shared.TrustedState{
54
  LastTrustedBatches: []*state.Batch{&batchA},
55
  }
56
+ sut := l2_shared.NewProcessorTrustedBatchSync(mockExecutor, mockTimer)
57
 
58
  current, previous := sut.GetCurrentAndPreviousBatchFromCache(&status)
59
  require.Nil(t, previous)
 
71
  status := l2_shared.TrustedState{
72
  LastTrustedBatches: []*state.Batch{nil, &batchA},
73
  }
74
+ sut := l2_shared.NewProcessorTrustedBatchSync(mockExecutor, mockTimer)
75
 
76
  current, previous := sut.GetCurrentAndPreviousBatchFromCache(&status)
77
  require.Nil(t, current)
 
94
  return &TestDataForProcessorTrustedBatchSync{
95
  mockTimer: mockTimer,
96
  mockExecutor: mockExecutor,
97
+ sut: l2_shared.NewProcessorTrustedBatchSync(mockExecutor, mockTimer),
98
  stateCurrentBatch: &state.Batch{
99
  BatchNumber: 123,
100
  Coinbase: common.HexToAddress("0x1230"),
 
187
  require.NoError(t, err)
188
  require.Equal(t, l2_shared.NothingProcessMode, processData.Mode, "current batch and trusted batch are the same, just need to be closed")
189
  require.Equal(t, false, processData.BatchMustBeClosed, "nothing to do")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  }
191
 
192
  func TestGetNextStatusClear(t *testing.T) {
{/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/l2_sync_etrog/executor_trusted_batch_sync.go RENAMED
@@ -58,15 +58,14 @@
58
  // NewSyncTrustedBatchExecutorForEtrog creates a new prcessor for sync with L2 batches
59
  func NewSyncTrustedBatchExecutorForEtrog(zkEVMClient syncinterfaces.ZKEVMClientTrustedBatchesGetter,
60
  state l2_shared.StateInterface, stateBatchExecutor StateInterface,
61
- sync syncinterfaces.SynchronizerFlushIDManager, timeProvider syncCommon.TimeProvider, l1SyncChecker L1SyncChecker,
62
- cfg l2_sync.Config) *l2_shared.TrustedBatchesRetrieve {
63
  executorSteps := &SyncTrustedBatchExecutorForEtrog{
64
  state: stateBatchExecutor,
65
  sync: sync,
66
  l1SyncChecker: l1SyncChecker,
67
  }
68
 
69
- executor := l2_shared.NewProcessorTrustedBatchSync(executorSteps, timeProvider, cfg)
70
  a := l2_shared.NewTrustedBatchesRetrieve(executor, zkEVMClient, state, sync, *l2_shared.NewTrustedStateManager(timeProvider, time.Hour))
71
  return a
72
  }
@@ -108,28 +107,18 @@
108
 
109
  // CreateEmptyBatch create a new empty batch (no batchL2Data and WIP)
110
  func (b *SyncTrustedBatchExecutorForEtrog) CreateEmptyBatch(ctx context.Context, data *l2_shared.ProcessData, dbTx pgx.Tx) (*l2_shared.ProcessResponse, error) {
111
- log.Debugf("%s The Batch is a empty (batchl2data=0 bytes), so just creating a DB entry", data.DebugPrefix)
112
  err := b.openBatch(ctx, data.TrustedBatch, dbTx, data.DebugPrefix)
113
  if err != nil {
114
  log.Errorf("%s error openning batch. Error: %v", data.DebugPrefix, err)
115
  return nil, err
116
  }
117
- if data.BatchMustBeClosed {
118
- log.Infof("%s Closing empty batch (no execution)", data.DebugPrefix)
119
- err = b.CloseBatch(ctx, data.TrustedBatch, dbTx, data.DebugPrefix)
120
- if err != nil {
121
- log.Error("%s error closing batch. Error: ", data.DebugPrefix, err)
122
- return nil, err
123
- }
124
- } else {
125
- log.Debugf("%s updateWIPBatch", data.DebugPrefix)
126
- err = b.updateWIPBatch(ctx, data, data.TrustedBatch.StateRoot, dbTx)
127
- if err != nil {
128
- log.Errorf("%s error updateWIPBatch. Error: ", data.DebugPrefix, err)
129
- return nil, err
130
- }
131
  }
132
-
133
  res := l2_shared.NewProcessResponse()
134
  stateBatch := syncCommon.RpcBatchToStateBatch(data.TrustedBatch)
135
  res.UpdateCurrentBatch(stateBatch)
@@ -139,8 +128,7 @@
139
  // FullProcess process a batch that is not on database, so is the first time we process it
140
  func (b *SyncTrustedBatchExecutorForEtrog) FullProcess(ctx context.Context, data *l2_shared.ProcessData, dbTx pgx.Tx) (*l2_shared.ProcessResponse, error) {
141
  log.Debugf("%s FullProcess", data.DebugPrefix)
142
- if len(data.TrustedBatch.BatchL2Data) == 0 {
143
- data.DebugPrefix += " (emptyBatch) "
144
  return b.CreateEmptyBatch(ctx, data, dbTx)
145
  }
146
  err := b.checkIfWeAreSyncedFromL1ToProcessGlobalExitRoot(ctx, data, dbTx)
@@ -336,7 +324,6 @@
336
  LocalExitRoot: trustedBatch.LocalExitRoot,
337
  BatchL2Data: trustedBatch.BatchL2Data,
338
  AccInputHash: trustedBatch.AccInputHash,
339
- ClosingReason: state.SyncL2TrustedBatchClosingReason,
340
  }
341
  log.Debugf("%s closing batch %v", debugStr, trustedBatch.Number)
342
  // This update SET state_root = $1, local_exit_root = $2, acc_input_hash = $3, raw_txs_data = $4, batch_resources = $5, closing_reason = $6, wip = FALSE
@@ -446,6 +433,7 @@
446
  Transactions: data.TrustedBatch.BatchL2Data,
447
  ForkID: b.state.GetForkIDByBatchNumber(uint64(data.TrustedBatch.Number)),
448
  SkipVerifyL1InfoRoot_V2: true,
 
449
  }
450
  return request
451
  }
 
58
  // NewSyncTrustedBatchExecutorForEtrog creates a new prcessor for sync with L2 batches
59
  func NewSyncTrustedBatchExecutorForEtrog(zkEVMClient syncinterfaces.ZKEVMClientTrustedBatchesGetter,
60
  state l2_shared.StateInterface, stateBatchExecutor StateInterface,
61
+ sync syncinterfaces.SynchronizerFlushIDManager, timeProvider syncCommon.TimeProvider, l1SyncChecker L1SyncChecker) *l2_shared.TrustedBatchesRetrieve {
 
62
  executorSteps := &SyncTrustedBatchExecutorForEtrog{
63
  state: stateBatchExecutor,
64
  sync: sync,
65
  l1SyncChecker: l1SyncChecker,
66
  }
67
 
68
+ executor := l2_shared.NewProcessorTrustedBatchSync(executorSteps, timeProvider)
69
  a := l2_shared.NewTrustedBatchesRetrieve(executor, zkEVMClient, state, sync, *l2_shared.NewTrustedStateManager(timeProvider, time.Hour))
70
  return a
71
  }
 
107
 
108
  // CreateEmptyBatch create a new empty batch (no batchL2Data and WIP)
109
  func (b *SyncTrustedBatchExecutorForEtrog) CreateEmptyBatch(ctx context.Context, data *l2_shared.ProcessData, dbTx pgx.Tx) (*l2_shared.ProcessResponse, error) {
110
+ log.Debugf("%s The Batch is a WIP empty, so just creating a DB entry", data.DebugPrefix)
111
  err := b.openBatch(ctx, data.TrustedBatch, dbTx, data.DebugPrefix)
112
  if err != nil {
113
  log.Errorf("%s error openning batch. Error: %v", data.DebugPrefix, err)
114
  return nil, err
115
  }
116
+ log.Debugf("%s updateWIPBatch", data.DebugPrefix)
117
+ err = b.updateWIPBatch(ctx, data, data.TrustedBatch.StateRoot, dbTx)
118
+ if err != nil {
119
+ log.Errorf("%s error updateWIPBatch. Error: ", data.DebugPrefix, err)
120
+ return nil, err
 
 
 
 
 
 
 
 
 
121
  }
 
122
  res := l2_shared.NewProcessResponse()
123
  stateBatch := syncCommon.RpcBatchToStateBatch(data.TrustedBatch)
124
  res.UpdateCurrentBatch(stateBatch)
 
128
  // FullProcess process a batch that is not on database, so is the first time we process it
129
  func (b *SyncTrustedBatchExecutorForEtrog) FullProcess(ctx context.Context, data *l2_shared.ProcessData, dbTx pgx.Tx) (*l2_shared.ProcessResponse, error) {
130
  log.Debugf("%s FullProcess", data.DebugPrefix)
131
+ if len(data.TrustedBatch.BatchL2Data) == 0 && !data.BatchMustBeClosed {
 
132
  return b.CreateEmptyBatch(ctx, data, dbTx)
133
  }
134
  err := b.checkIfWeAreSyncedFromL1ToProcessGlobalExitRoot(ctx, data, dbTx)
 
324
  LocalExitRoot: trustedBatch.LocalExitRoot,
325
  BatchL2Data: trustedBatch.BatchL2Data,
326
  AccInputHash: trustedBatch.AccInputHash,
 
327
  }
328
  log.Debugf("%s closing batch %v", debugStr, trustedBatch.Number)
329
  // This update SET state_root = $1, local_exit_root = $2, acc_input_hash = $3, raw_txs_data = $4, batch_resources = $5, closing_reason = $6, wip = FALSE
 
433
  Transactions: data.TrustedBatch.BatchL2Data,
434
  ForkID: b.state.GetForkIDByBatchNumber(uint64(data.TrustedBatch.Number)),
435
  SkipVerifyL1InfoRoot_V2: true,
436
+ ExecutionMode: executor.ExecutionMode1,
437
  }
438
  return request
439
  }
{/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/l2_sync_etrog/executor_trusted_batch_sync_test.go RENAMED
@@ -304,43 +304,3 @@
304
  require.Equal(t, 0, len(response.UpdateBatch.BatchL2Data))
305
  require.Equal(t, expectedBatch, *response.UpdateBatch)
306
  }
307
-
308
- func TestEmptyBatchClosed(t *testing.T) {
309
- testData := newTestData(t)
310
- // Arrange
311
- expectedBatch := state.Batch{
312
- BatchNumber: 123,
313
- Coinbase: common.HexToAddress("0x01"),
314
- StateRoot: common.HexToHash("0x02"),
315
- GlobalExitRoot: common.HexToHash("0x03"),
316
- LocalExitRoot: common.HexToHash("0x04"),
317
- Timestamp: time.Now().Truncate(time.Second),
318
- WIP: false,
319
- }
320
- data := l2_shared.ProcessData{
321
- BatchNumber: 123,
322
- Mode: l2_shared.FullProcessMode,
323
- BatchMustBeClosed: true,
324
- DebugPrefix: "test",
325
- StateBatch: nil,
326
- TrustedBatch: &types.Batch{
327
- Number: 123,
328
- Coinbase: expectedBatch.Coinbase,
329
- StateRoot: expectedBatch.StateRoot,
330
- GlobalExitRoot: expectedBatch.GlobalExitRoot,
331
- LocalExitRoot: expectedBatch.LocalExitRoot,
332
- Timestamp: (types.ArgUint64)(expectedBatch.Timestamp.Unix()),
333
- Closed: true,
334
- },
335
- }
336
- testData.stateMock.EXPECT().OpenBatch(testData.ctx, mock.Anything, mock.Anything).Return(nil).Once()
337
- testData.stateMock.EXPECT().CloseBatch(testData.ctx, mock.Anything, mock.Anything).Return(nil).Once()
338
-
339
- response, err := testData.sut.FullProcess(testData.ctx, &data, nil)
340
- require.NoError(t, err)
341
- require.Equal(t, false, response.ClearCache)
342
- require.Equal(t, false, response.UpdateBatchWithProcessBatchResponse)
343
- require.Equal(t, false, response.UpdateBatch.WIP)
344
- require.Equal(t, 0, len(response.UpdateBatch.BatchL2Data))
345
- require.Equal(t, expectedBatch, *response.UpdateBatch)
346
- }
 
304
  require.Equal(t, 0, len(response.UpdateBatch.BatchL2Data))
305
  require.Equal(t, expectedBatch, *response.UpdateBatch)
306
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
{/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/l2_sync/l2_sync_incaberry/sync_trusted_state.go RENAMED
@@ -196,6 +196,7 @@
196
  OldAccInputHash: batches[1].AccInputHash,
197
  Coinbase: common.HexToAddress(trustedBatch.Coinbase.String()),
198
  Timestamp_V1: time.Unix(int64(trustedBatch.Timestamp), 0),
 
199
  }
200
  // check if batch needs to be synchronized
201
  if batches[0] != nil {
 
196
  OldAccInputHash: batches[1].AccInputHash,
197
  Coinbase: common.HexToAddress(trustedBatch.Coinbase.String()),
198
  Timestamp_V1: time.Unix(int64(trustedBatch.Timestamp), 0),
199
+ ExecutionMode: executor.ExecutionMode1,
200
  }
201
  // check if batch needs to be synchronized
202
  if batches[0] != nil {
{/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/synchronizer.go RENAMED
@@ -109,19 +109,16 @@
109
  l1EventProcessors: nil,
110
  halter: syncCommon.NewCriticalErrorHalt(eventLog, 5*time.Second), //nolint:gomnd
111
  }
 
 
 
 
 
 
 
 
 
112
 
113
- if !isTrustedSequencer {
114
- log.Info("Permissionless: creating and Initializing L2 synchronization components")
115
- L1SyncChecker := l2_sync_etrog.NewCheckSyncStatusToProcessBatch(res.zkEVMClient, res.state)
116
-
117
- syncTrustedStateEtrog := l2_sync_etrog.NewSyncTrustedBatchExecutorForEtrog(res.zkEVMClient, res.state, res.state, res,
118
- syncCommon.DefaultTimeProvider{}, L1SyncChecker, cfg.L2Synchronization)
119
-
120
- res.syncTrustedStateExecutor = l2_shared.NewSyncTrustedStateExecutorSelector(map[uint64]syncinterfaces.SyncTrustedStateExecutor{
121
- uint64(state.FORKID_ETROG): syncTrustedStateEtrog,
122
- uint64(state.FORKID_ELDERBERRY): syncTrustedStateEtrog,
123
- }, res.state)
124
- }
125
  res.l1EventProcessors = defaultsL1EventProcessors(res)
126
  switch cfg.L1SynchronizationMode {
127
  case ParallelMode:
@@ -207,7 +204,7 @@
207
  if err != nil {
208
  if errors.Is(err, state.ErrStateNotSynchronized) {
209
  log.Info("State is empty, verifying genesis block")
210
- valid, err := s.etherMan.VerifyGenBlockNumber(s.ctx, s.genesis.BlockNumber)
211
  if err != nil {
212
  log.Error("error checking genesis block number. Error: ", err)
213
  return rollback(s.ctx, dbTx, err)
@@ -215,12 +212,42 @@
215
  log.Error("genesis Block number configured is not valid. It is required the block number where the PolygonZkEVM smc was deployed")
216
  return rollback(s.ctx, dbTx, fmt.Errorf("genesis Block number configured is not valid. It is required the block number where the PolygonZkEVM smc was deployed"))
217
  }
218
- log.Info("Setting genesis block")
219
- header, err := s.etherMan.HeaderByNumber(s.ctx, big.NewInt(0).SetUint64(s.genesis.BlockNumber))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  if err != nil {
221
- log.Errorf("error getting l1 block header for block %d. Error: %v", s.genesis.BlockNumber, err)
222
  return rollback(s.ctx, dbTx, err)
223
  }
 
224
  lastEthBlockSynced = &state.Block{
225
  BlockNumber: header.Number.Uint64(),
226
  BlockHash: header.Hash(),
@@ -708,7 +735,7 @@
708
  return nil, err
709
  }
710
  // Compare hashes
711
- if (block.Hash() != latestBlock.BlockHash || block.ParentHash() != latestBlock.ParentHash) && latestBlock.BlockNumber > s.genesis.BlockNumber {
712
  log.Infof("checkReorg: Bad block %d hashOk %t parentHashOk %t", latestBlock.BlockNumber, block.Hash() == latestBlock.BlockHash, block.ParentHash() == latestBlock.ParentHash)
713
  log.Debug("[checkReorg function] => latestBlockNumber: ", latestBlock.BlockNumber)
714
  log.Debug("[checkReorg function] => latestBlockHash: ", latestBlock.BlockHash)
 
109
  l1EventProcessors: nil,
110
  halter: syncCommon.NewCriticalErrorHalt(eventLog, 5*time.Second), //nolint:gomnd
111
  }
112
+ L1SyncChecker := l2_sync_etrog.NewCheckSyncStatusToProcessBatch(res.zkEVMClient, res.state)
113
+
114
+ syncTrustedStateEtrog := l2_sync_etrog.NewSyncTrustedBatchExecutorForEtrog(res.zkEVMClient, res.state, res.state, res,
115
+ syncCommon.DefaultTimeProvider{}, L1SyncChecker)
116
+
117
+ res.syncTrustedStateExecutor = l2_shared.NewSyncTrustedStateExecutorSelector(map[uint64]syncinterfaces.SyncTrustedStateExecutor{
118
+ uint64(state.FORKID_ETROG): syncTrustedStateEtrog,
119
+ uint64(state.FORKID_ELDERBERRY): syncTrustedStateEtrog,
120
+ }, res.state)
121
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  res.l1EventProcessors = defaultsL1EventProcessors(res)
123
  switch cfg.L1SynchronizationMode {
124
  case ParallelMode:
 
204
  if err != nil {
205
  if errors.Is(err, state.ErrStateNotSynchronized) {
206
  log.Info("State is empty, verifying genesis block")
207
+ valid, err := s.etherMan.VerifyGenBlockNumber(s.ctx, s.genesis.RollupBlockNumber)
208
  if err != nil {
209
  log.Error("error checking genesis block number. Error: ", err)
210
  return rollback(s.ctx, dbTx, err)
 
212
  log.Error("genesis Block number configured is not valid. It is required the block number where the PolygonZkEVM smc was deployed")
213
  return rollback(s.ctx, dbTx, fmt.Errorf("genesis Block number configured is not valid. It is required the block number where the PolygonZkEVM smc was deployed"))
214
  }
215
+
216
+ // Sync events from RollupManager that happen before rollup creation
217
+ log.Info("synchronizing events from RollupManager that happen before rollup creation")
218
+ for i := s.genesis.RollupManagerBlockNumber; true; i += s.cfg.SyncChunkSize {
219
+ toBlock := min(i+s.cfg.SyncChunkSize-1, s.genesis.RollupBlockNumber-1)
220
+ blocks, order, err := s.etherMan.GetRollupInfoByBlockRange(s.ctx, i, &toBlock)
221
+ if err != nil {
222
+ log.Error("error getting rollupInfoByBlockRange before rollup genesis: ", err)
223
+ rollbackErr := dbTx.Rollback(s.ctx)
224
+ if rollbackErr != nil {
225
+ log.Errorf("error rolling back state. RollbackErr: %v, err: %s", rollbackErr, err.Error())
226
+ return rollbackErr
227
+ }
228
+ return err
229
+ }
230
+ err = s.ProcessBlockRange(blocks, order)
231
+ if err != nil {
232
+ log.Error("error processing blocks before the genesis: ", err)
233
+ rollbackErr := dbTx.Rollback(s.ctx)
234
+ if rollbackErr != nil {
235
+ log.Errorf("error rolling back state. RollbackErr: %v, err: %s", rollbackErr, err.Error())
236
+ return rollbackErr
237
+ }
238
+ return err
239
+ }
240
+ if toBlock == s.genesis.RollupBlockNumber-1 {
241
+ break
242
+ }
243
+ }
244
+
245
+ header, err := s.etherMan.HeaderByNumber(s.ctx, big.NewInt(0).SetUint64(s.genesis.RollupBlockNumber))
246
  if err != nil {
247
+ log.Errorf("error getting l1 block header for block %d. Error: %v", s.genesis.RollupBlockNumber, err)
248
  return rollback(s.ctx, dbTx, err)
249
  }
250
+ log.Info("synchronizing rollup creation block")
251
  lastEthBlockSynced = &state.Block{
252
  BlockNumber: header.Number.Uint64(),
253
  BlockHash: header.Hash(),
 
735
  return nil, err
736
  }
737
  // Compare hashes
738
+ if (block.Hash() != latestBlock.BlockHash || block.ParentHash() != latestBlock.ParentHash) && latestBlock.BlockNumber > s.genesis.RollupBlockNumber {
739
  log.Infof("checkReorg: Bad block %d hashOk %t parentHashOk %t", latestBlock.BlockNumber, block.Hash() == latestBlock.BlockHash, block.ParentHash() == latestBlock.ParentHash)
740
  log.Debug("[checkReorg function] => latestBlockNumber: ", latestBlock.BlockNumber)
741
  log.Debug("[checkReorg function] => latestBlockHash: ", latestBlock.BlockHash)
{/home/stefan/go/src/Polygon/zkevm-node → .}/synchronizer/synchronizer_test.go RENAMED
@@ -29,7 +29,6 @@
29
  ETROG_MODE_FLAG = true
30
  RETRIEVE_BATCH_FROM_DB_FLAG = true
31
  RETRIEVE_BATCH_FROM_CACHE_FLAG = false
32
- PROCESS_BATCH_SELECTOR_ENABLED = false
33
  )
34
 
35
  type mocks struct {
@@ -120,7 +119,7 @@
120
  // but it used a feature that is not implemented in new one that is asking beyond the last block on L1
121
  func TestForcedBatchEtrog(t *testing.T) {
122
  genesis := state.Genesis{
123
- BlockNumber: uint64(123456),
124
  }
125
  cfg := Config{
126
  SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
@@ -373,7 +372,7 @@
373
  // but it used a feature that is not implemented in new one that is asking beyond the last block on L1
374
  func TestSequenceForcedBatchIncaberry(t *testing.T) {
375
  genesis := state.Genesis{
376
- BlockNumber: uint64(123456),
377
  }
378
  cfg := Config{
379
  SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
@@ -612,7 +611,7 @@
612
 
613
  func setupGenericTest(t *testing.T) (*state.Genesis, *Config, *mocks) {
614
  genesis := state.Genesis{
615
- BlockNumber: uint64(123456),
616
  }
617
  cfg := Config{
618
  SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
@@ -712,11 +711,9 @@
712
  transactions := []types.TransactionOrHash{}
713
  for nBlock := 0; nBlock < howManyBlocks; nBlock++ {
714
  block := state.L2BlockRaw{
715
- ChangeL2BlockHeader: state.ChangeL2BlockHeader{
716
- DeltaTimestamp: 123,
717
- IndexL1InfoTree: 456,
718
- },
719
- Transactions: []state.L2TxRaw{},
720
  }
721
  for i := 0; i < howManyTx; i++ {
722
  tx := createTransaction(uint64(i + 1))
 
29
  ETROG_MODE_FLAG = true
30
  RETRIEVE_BATCH_FROM_DB_FLAG = true
31
  RETRIEVE_BATCH_FROM_CACHE_FLAG = false
 
32
  )
33
 
34
  type mocks struct {
 
119
  // but it used a feature that is not implemented in new one that is asking beyond the last block on L1
120
  func TestForcedBatchEtrog(t *testing.T) {
121
  genesis := state.Genesis{
122
+ RollupBlockNumber: uint64(123456),
123
  }
124
  cfg := Config{
125
  SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
 
372
  // but it used a feature that is not implemented in new one that is asking beyond the last block on L1
373
  func TestSequenceForcedBatchIncaberry(t *testing.T) {
374
  genesis := state.Genesis{
375
+ RollupBlockNumber: uint64(123456),
376
  }
377
  cfg := Config{
378
  SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
 
611
 
612
  func setupGenericTest(t *testing.T) (*state.Genesis, *Config, *mocks) {
613
  genesis := state.Genesis{
614
+ RollupBlockNumber: uint64(123456),
615
  }
616
  cfg := Config{
617
  SyncInterval: cfgTypes.Duration{Duration: 1 * time.Second},
 
711
  transactions := []types.TransactionOrHash{}
712
  for nBlock := 0; nBlock < howManyBlocks; nBlock++ {
713
  block := state.L2BlockRaw{
714
+ DeltaTimestamp: 123,
715
+ IndexL1InfoTree: 456,
716
+ Transactions: []state.L2TxRaw{},
 
 
717
  }
718
  for i := 0; i < howManyTx; i++ {
719
  tx := createTransaction(uint64(i + 1))
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/auto/customModExp.sol RENAMED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity >=0.7.0 <0.9.0;
3
+
4
+ contract customModExp {
5
+ bytes32 hashResult;
6
+ address retEcrecover;
7
+ bytes dataResult;
8
+ uint256 dataRes;
9
+
10
+ bytes32[10] arrayStorage;
11
+
12
+ function modExpGeneric(bytes memory input) public {
13
+ bytes32[10] memory output;
14
+
15
+ assembly {
16
+ let success := staticcall(gas(), 0x05, add(input, 32), mload(input), output, 0x140)
17
+ sstore(0x00, success)
18
+ }
19
+
20
+ for (uint i = 0; i < 10; i++) {
21
+ arrayStorage[i] = output[i];
22
+ }
23
+ }
24
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/bin/customModExp/customModExp.go RENAMED
@@ -1,224 +0,0 @@
1
- // Code generated - DO NOT EDIT.
2
- // This file is a generated binding and any manual changes will be lost.
3
-
4
- package customModExp
5
-
6
- import (
7
- "errors"
8
- "math/big"
9
- "strings"
10
-
11
- ethereum "github.com/ethereum/go-ethereum"
12
- "github.com/ethereum/go-ethereum/accounts/abi"
13
- "github.com/ethereum/go-ethereum/accounts/abi/bind"
14
- "github.com/ethereum/go-ethereum/common"
15
- "github.com/ethereum/go-ethereum/core/types"
16
- "github.com/ethereum/go-ethereum/event"
17
- )
18
-
19
- // Reference imports to suppress errors if they are not otherwise used.
20
- var (
21
- _ = errors.New
22
- _ = big.NewInt
23
- _ = strings.NewReader
24
- _ = ethereum.NotFound
25
- _ = bind.Bind
26
- _ = common.Big1
27
- _ = types.BloomLookup
28
- _ = event.NewSubscription
29
- _ = abi.ConvertType
30
- )
31
-
32
- // CustomModExpMetaData contains all meta data concerning the CustomModExp contract.
33
- var CustomModExpMetaData = &bind.MetaData{
34
- ABI: "[{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"input\",\"type\":\"bytes\"}],\"name\":\"modExpGeneric\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]",
35
- Bin: "0x608060405234801561001057600080fd5b50610208806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c8063d5665d6f14610030575b600080fd5b61004361003e3660046100e2565b610045565b005b61004d6100ad565b6101408183516020850160055afa60009081555b600a8110156100a8578181600a811061007c5761007c610193565b6020020151600482600a811061009457610094610193565b0155806100a0816101a9565b915050610061565b505050565b604051806101400160405280600a906020820280368337509192915050565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156100f457600080fd5b813567ffffffffffffffff8082111561010c57600080fd5b818401915084601f83011261012057600080fd5b813581811115610132576101326100cc565b604051601f8201601f19908116603f0116810190838211818310171561015a5761015a6100cc565b8160405282815287602084870101111561017357600080fd5b826020860160208301376000928101602001929092525095945050505050565b634e487b7160e01b600052603260045260246000fd5b60006000198214156101cb57634e487b7160e01b600052601160045260246000fd5b506001019056fea26469706673582212206c4940b4c9a7086754420734c8b4921cdb547ec8b31fc3bf8cd884ad9778a5b364736f6c634300080c0033",
36
- }
37
-
38
- // CustomModExpABI is the input ABI used to generate the binding from.
39
- // Deprecated: Use CustomModExpMetaData.ABI instead.
40
- var CustomModExpABI = CustomModExpMetaData.ABI
41
-
42
- // CustomModExpBin is the compiled bytecode used for deploying new contracts.
43
- // Deprecated: Use CustomModExpMetaData.Bin instead.
44
- var CustomModExpBin = CustomModExpMetaData.Bin
45
-
46
- // DeployCustomModExp deploys a new Ethereum contract, binding an instance of CustomModExp to it.
47
- func DeployCustomModExp(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *CustomModExp, error) {
48
- parsed, err := CustomModExpMetaData.GetAbi()
49
- if err != nil {
50
- return common.Address{}, nil, nil, err
51
- }
52
- if parsed == nil {
53
- return common.Address{}, nil, nil, errors.New("GetABI returned nil")
54
- }
55
-
56
- address, tx, contract, err := bind.DeployContract(auth, *parsed, common.FromHex(CustomModExpBin), backend)
57
- if err != nil {
58
- return common.Address{}, nil, nil, err
59
- }
60
- return address, tx, &CustomModExp{CustomModExpCaller: CustomModExpCaller{contract: contract}, CustomModExpTransactor: CustomModExpTransactor{contract: contract}, CustomModExpFilterer: CustomModExpFilterer{contract: contract}}, nil
61
- }
62
-
63
- // CustomModExp is an auto generated Go binding around an Ethereum contract.
64
- type CustomModExp struct {
65
- CustomModExpCaller // Read-only binding to the contract
66
- CustomModExpTransactor // Write-only binding to the contract
67
- CustomModExpFilterer // Log filterer for contract events
68
- }
69
-
70
- // CustomModExpCaller is an auto generated read-only Go binding around an Ethereum contract.
71
- type CustomModExpCaller struct {
72
- contract *bind.BoundContract // Generic contract wrapper for the low level calls
73
- }
74
-
75
- // CustomModExpTransactor is an auto generated write-only Go binding around an Ethereum contract.
76
- type CustomModExpTransactor struct {
77
- contract *bind.BoundContract // Generic contract wrapper for the low level calls
78
- }
79
-
80
- // CustomModExpFilterer is an auto generated log filtering Go binding around an Ethereum contract events.
81
- type CustomModExpFilterer struct {
82
- contract *bind.BoundContract // Generic contract wrapper for the low level calls
83
- }
84
-
85
- // CustomModExpSession is an auto generated Go binding around an Ethereum contract,
86
- // with pre-set call and transact options.
87
- type CustomModExpSession struct {
88
- Contract *CustomModExp // Generic contract binding to set the session for
89
- CallOpts bind.CallOpts // Call options to use throughout this session
90
- TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
91
- }
92
-
93
- // CustomModExpCallerSession is an auto generated read-only Go binding around an Ethereum contract,
94
- // with pre-set call options.
95
- type CustomModExpCallerSession struct {
96
- Contract *CustomModExpCaller // Generic contract caller binding to set the session for
97
- CallOpts bind.CallOpts // Call options to use throughout this session
98
- }
99
-
100
- // CustomModExpTransactorSession is an auto generated write-only Go binding around an Ethereum contract,
101
- // with pre-set transact options.
102
- type CustomModExpTransactorSession struct {
103
- Contract *CustomModExpTransactor // Generic contract transactor binding to set the session for
104
- TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session
105
- }
106
-
107
- // CustomModExpRaw is an auto generated low-level Go binding around an Ethereum contract.
108
- type CustomModExpRaw struct {
109
- Contract *CustomModExp // Generic contract binding to access the raw methods on
110
- }
111
-
112
- // CustomModExpCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract.
113
- type CustomModExpCallerRaw struct {
114
- Contract *CustomModExpCaller // Generic read-only contract binding to access the raw methods on
115
- }
116
-
117
- // CustomModExpTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract.
118
- type CustomModExpTransactorRaw struct {
119
- Contract *CustomModExpTransactor // Generic write-only contract binding to access the raw methods on
120
- }
121
-
122
- // NewCustomModExp creates a new instance of CustomModExp, bound to a specific deployed contract.
123
- func NewCustomModExp(address common.Address, backend bind.ContractBackend) (*CustomModExp, error) {
124
- contract, err := bindCustomModExp(address, backend, backend, backend)
125
- if err != nil {
126
- return nil, err
127
- }
128
- return &CustomModExp{CustomModExpCaller: CustomModExpCaller{contract: contract}, CustomModExpTransactor: CustomModExpTransactor{contract: contract}, CustomModExpFilterer: CustomModExpFilterer{contract: contract}}, nil
129
- }
130
-
131
- // NewCustomModExpCaller creates a new read-only instance of CustomModExp, bound to a specific deployed contract.
132
- func NewCustomModExpCaller(address common.Address, caller bind.ContractCaller) (*CustomModExpCaller, error) {
133
- contract, err := bindCustomModExp(address, caller, nil, nil)
134
- if err != nil {
135
- return nil, err
136
- }
137
- return &CustomModExpCaller{contract: contract}, nil
138
- }
139
-
140
- // NewCustomModExpTransactor creates a new write-only instance of CustomModExp, bound to a specific deployed contract.
141
- func NewCustomModExpTransactor(address common.Address, transactor bind.ContractTransactor) (*CustomModExpTransactor, error) {
142
- contract, err := bindCustomModExp(address, nil, transactor, nil)
143
- if err != nil {
144
- return nil, err
145
- }
146
- return &CustomModExpTransactor{contract: contract}, nil
147
- }
148
-
149
- // NewCustomModExpFilterer creates a new log filterer instance of CustomModExp, bound to a specific deployed contract.
150
- func NewCustomModExpFilterer(address common.Address, filterer bind.ContractFilterer) (*CustomModExpFilterer, error) {
151
- contract, err := bindCustomModExp(address, nil, nil, filterer)
152
- if err != nil {
153
- return nil, err
154
- }
155
- return &CustomModExpFilterer{contract: contract}, nil
156
- }
157
-
158
- // bindCustomModExp binds a generic wrapper to an already deployed contract.
159
- func bindCustomModExp(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {
160
- parsed, err := CustomModExpMetaData.GetAbi()
161
- if err != nil {
162
- return nil, err
163
- }
164
- return bind.NewBoundContract(address, *parsed, caller, transactor, filterer), nil
165
- }
166
-
167
- // Call invokes the (constant) contract method with params as input values and
168
- // sets the output to result. The result type might be a single field for simple
169
- // returns, a slice of interfaces for anonymous returns and a struct for named
170
- // returns.
171
- func (_CustomModExp *CustomModExpRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
172
- return _CustomModExp.Contract.CustomModExpCaller.contract.Call(opts, result, method, params...)
173
- }
174
-
175
- // Transfer initiates a plain transaction to move funds to the contract, calling
176
- // its default method if one is available.
177
- func (_CustomModExp *CustomModExpRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
178
- return _CustomModExp.Contract.CustomModExpTransactor.contract.Transfer(opts)
179
- }
180
-
181
- // Transact invokes the (paid) contract method with params as input values.
182
- func (_CustomModExp *CustomModExpRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
183
- return _CustomModExp.Contract.CustomModExpTransactor.contract.Transact(opts, method, params...)
184
- }
185
-
186
- // Call invokes the (constant) contract method with params as input values and
187
- // sets the output to result. The result type might be a single field for simple
188
- // returns, a slice of interfaces for anonymous returns and a struct for named
189
- // returns.
190
- func (_CustomModExp *CustomModExpCallerRaw) Call(opts *bind.CallOpts, result *[]interface{}, method string, params ...interface{}) error {
191
- return _CustomModExp.Contract.contract.Call(opts, result, method, params...)
192
- }
193
-
194
- // Transfer initiates a plain transaction to move funds to the contract, calling
195
- // its default method if one is available.
196
- func (_CustomModExp *CustomModExpTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {
197
- return _CustomModExp.Contract.contract.Transfer(opts)
198
- }
199
-
200
- // Transact invokes the (paid) contract method with params as input values.
201
- func (_CustomModExp *CustomModExpTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
202
- return _CustomModExp.Contract.contract.Transact(opts, method, params...)
203
- }
204
-
205
- // ModExpGeneric is a paid mutator transaction binding the contract method 0xd5665d6f.
206
- //
207
- // Solidity: function modExpGeneric(bytes input) returns()
208
- func (_CustomModExp *CustomModExpTransactor) ModExpGeneric(opts *bind.TransactOpts, input []byte) (*types.Transaction, error) {
209
- return _CustomModExp.contract.Transact(opts, "modExpGeneric", input)
210
- }
211
-
212
- // ModExpGeneric is a paid mutator transaction binding the contract method 0xd5665d6f.
213
- //
214
- // Solidity: function modExpGeneric(bytes input) returns()
215
- func (_CustomModExp *CustomModExpSession) ModExpGeneric(input []byte) (*types.Transaction, error) {
216
- return _CustomModExp.Contract.ModExpGeneric(&_CustomModExp.TransactOpts, input)
217
- }
218
-
219
- // ModExpGeneric is a paid mutator transaction binding the contract method 0xd5665d6f.
220
- //
221
- // Solidity: function modExpGeneric(bytes input) returns()
222
- func (_CustomModExp *CustomModExpTransactorSession) ModExpGeneric(input []byte) (*types.Transaction, error) {
223
- return _CustomModExp.Contract.ModExpGeneric(&_CustomModExp.TransactOpts, input)
224
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/contracts/bin/triggerErrors/triggerErrors.go RENAMED
@@ -32,7 +32,7 @@
32
  // TriggerErrorsMetaData contains all meta data concerning the TriggerErrors contract.
33
  var TriggerErrorsMetaData = &bind.MetaData{
34
  ABI: "[{\"inputs\":[],\"name\":\"count\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfCountersKeccaks\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"test\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfCountersPoseidon\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfCountersSteps\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfGas\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]",
35
- Bin: "0x60806040526000805534801561001457600080fd5b5061016c806100246000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c806306661abd1461005c5780632621002a1461007757806331fe52e8146100835780638bd7b5381461008d578063cb4e8cd114610095575b600080fd5b61006560005481565b60405190815260200160405180910390f35b620f4240600020610065565b61008b61009d565b005b61008b6100c3565b61008b6100e9565b60005b60648110156100c0578060005580806100b89061010d565b9150506100a0565b50565b60005b620186a08110156100c0576104d2600052806100e18161010d565b9150506100c6565b60005b61c3508110156100c0578060005580806101059061010d565b9150506100ec565b600060001982141561012f57634e487b7160e01b600052601160045260246000fd5b506001019056fea26469706673582212208f01c5dc055b1f376f5da5deb33e2c96ee776174bf48874c5ebba0f606de2ac564736f6c634300080c0033",
36
  }
37
 
38
  // TriggerErrorsABI is the input ABI used to generate the binding from.
 
32
  // TriggerErrorsMetaData contains all meta data concerning the TriggerErrors contract.
33
  var TriggerErrorsMetaData = &bind.MetaData{
34
  ABI: "[{\"inputs\":[],\"name\":\"count\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfCountersKeccaks\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"test\",\"type\":\"bytes32\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfCountersPoseidon\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfCountersSteps\",\"outputs\":[],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"outOfGas\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]",
35
+ Bin: "0x60806040526000805534801561001457600080fd5b5061016c806100246000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c806306661abd1461005c5780632621002a1461007757806331fe52e8146100835780638bd7b5381461008d578063cb4e8cd114610095575b600080fd5b61006560005481565b60405190815260200160405180910390f35b620f4240600020610065565b61008b61009d565b005b61008b6100c3565b61008b6100e9565b60005b60648110156100c0578060005580806100b89061010d565b9150506100a0565b50565b60005b620186a08110156100c0576104d2600052806100e18161010d565b9150506100c6565b60005b61c3508110156100c0578060005580806101059061010d565b9150506100ec565b600060001982141561012f57634e487b7160e01b600052601160045260246000fd5b506001019056fea264697066735822122097beacfaa873e4896937143dfea406cc278b929a28023f7e7020b6dea6e9fc7364736f6c634300080c0033",
36
  }
37
 
38
  // TriggerErrorsABI is the input ABI used to generate the binding from.
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/docker-compose.yml RENAMED
@@ -453,7 +453,7 @@
453
 
454
  zkevm-mock-l1-network:
455
  container_name: zkevm-mock-l1-network
456
- image: hermeznetwork/geth-zkevm-contracts:v2.1.3-fork.8-geth1.12.0
457
  ports:
458
  - 8545:8545
459
  - 8546:8546
@@ -638,3 +638,51 @@
638
  - ./config/test.genesis.config.json:/app/genesis.json
639
  command:
640
  - "/bin/sh"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
453
 
454
  zkevm-mock-l1-network:
455
  container_name: zkevm-mock-l1-network
456
+ image: hermeznetwork/geth-cdk-validium-contracts:v0.0.4
457
  ports:
458
  - 8545:8545
459
  - 8546:8546
 
638
  - ./config/test.genesis.config.json:/app/genesis.json
639
  command:
640
  - "/bin/sh"
641
+
642
+ zkevm-node-forced-DAC:
643
+ container_name: zkevm-node-forced-DAC
644
+ image: zkevm-node
645
+ ports:
646
+ - 8125:8125
647
+ environment:
648
+ - ZKEVM_NODE_ISTRUSTEDSEQUENCER=false
649
+ - ZKEVM_NODE_STATEDB_USER=test_user
650
+ - ZKEVM_NODE_STATEDB_PASSWORD=test_password
651
+ - ZKEVM_NODE_STATEDB_NAME=state_db
652
+ - ZKEVM_NODE_STATEDB_HOST=zkevm-permissionless-db
653
+ - ZKEVM_NODE_POOL_DB_USER=test_user
654
+ - ZKEVM_NODE_POOL_DB_PASSWORD=test_password
655
+ - ZKEVM_NODE_POOL_DB_NAME=pool_db
656
+ - ZKEVM_NODE_POOL_DB_HOST=zkevm-permissionless-db
657
+ - ZKEVM_NODE_RPC_PORT=8125
658
+ - ZKEVM_NODE_RPC_SEQUENCERNODEURI=http://zkevm-node-json-rpc:8123
659
+ - ZKEVM_NODE_SYNCHRONIZER_TRUSTEDSEQUENCERURL=http://you-cant-touch-this:8123
660
+ - ZKEVM_NODE_MTCLIENT_URI=zkevm-permissionless-prover:50061
661
+ - ZKEVM_NODE_EXECUTOR_URI=zkevm-permissionless-prover:50071
662
+ volumes:
663
+ - ./config/test.node.config.toml:/app/config.toml
664
+ - ./config/test.genesis.config.json:/app/genesis.json
665
+ command:
666
+ - "/bin/sh"
667
+ - "-c"
668
+ - "/app/zkevm-node run --network custom --custom-network-file /app/genesis.json --cfg /app/config.toml --components \"rpc,synchronizer\""
669
+
670
+ zkevm-data-node-db:
671
+ container_name: zkevm-data-node-db
672
+ restart: unless-stopped
673
+ image: postgres
674
+ healthcheck:
675
+ test: ["CMD-SHELL", "pg_isready -d $${POSTGRES_DB} -U $${POSTGRES_USER}"]
676
+ interval: 10s
677
+ timeout: 5s
678
+ retries: 5
679
+ ports:
680
+ - 5444:5432
681
+ environment:
682
+ - POSTGRES_USER=committee_user
683
+ - POSTGRES_PASSWORD=committee_password
684
+ - POSTGRES_DB=committee_db
685
+ command:
686
+ - "postgres"
687
+ - "-N"
688
+ - "500"
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/datacommittee_test.go RENAMED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ package e2e
2
+
3
+ import (
4
+ "context"
5
+ "crypto/ecdsa"
6
+ "encoding/json"
7
+ "fmt"
8
+ "math/big"
9
+ "os"
10
+ "os/exec"
11
+ "sort"
12
+ "strconv"
13
+ "strings"
14
+ "testing"
15
+ "time"
16
+
17
+ "github.com/0xPolygon/cdk-data-availability/config"
18
+ cTypes "github.com/0xPolygon/cdk-data-availability/config/types"
19
+ "github.com/0xPolygon/cdk-data-availability/db"
20
+ "github.com/0xPolygon/cdk-data-availability/rpc"
21
+ "github.com/0xPolygonHermez/zkevm-node/etherman/smartcontracts/polygondatacommittee"
22
+ "github.com/0xPolygonHermez/zkevm-node/log"
23
+ "github.com/0xPolygonHermez/zkevm-node/test/operations"
24
+ "github.com/ethereum/go-ethereum"
25
+ eTypes "github.com/ethereum/go-ethereum/core/types"
26
+
27
+ "github.com/ethereum/go-ethereum/accounts/keystore"
28
+ "github.com/ethereum/go-ethereum/common"
29
+ "github.com/ethereum/go-ethereum/crypto"
30
+ "github.com/ethereum/go-ethereum/ethclient"
31
+ "github.com/stretchr/testify/assert"
32
+ "github.com/stretchr/testify/require"
33
+ )
34
+
35
+ func TestDataCommittee(t *testing.T) {
36
+ const (
37
+ nSignatures = 4
38
+ mMembers = 5
39
+ ksFile = "/tmp/pkey"
40
+ cfgFile = "/tmp/dacnodeconfigfile.json"
41
+ ksPass = "pass"
42
+ dacNodeContainer = "hermeznetwork/cdk-data-availability:v0.0.4"
43
+ )
44
+
45
+ // Setup
46
+ var err error
47
+ if testing.Short() {
48
+ t.Skip()
49
+ }
50
+ ctx := context.Background()
51
+ defer func() {
52
+ require.NoError(t, operations.Teardown())
53
+ }()
54
+ err = operations.Teardown()
55
+ require.NoError(t, err)
56
+ opsCfg := operations.GetDefaultOperationsConfig()
57
+ opsCfg.State.MaxCumulativeGasUsed = 80000000000
58
+ opsman, err := operations.NewManager(ctx, opsCfg)
59
+ require.NoError(t, err)
60
+ defer func() {
61
+ require.NoError(t, opsman.StopDACDB())
62
+ }()
63
+ err = opsman.Setup()
64
+ require.NoError(t, err)
65
+ require.NoError(t, opsman.StartDACDB())
66
+ time.Sleep(5 * time.Second)
67
+ authL2, err := operations.GetAuth(operations.DefaultSequencerPrivateKey, operations.DefaultL2ChainID)
68
+ require.NoError(t, err)
69
+ authL1, err := operations.GetAuth(operations.DefaultSequencerPrivateKey, operations.DefaultL1ChainID)
70
+ require.NoError(t, err)
71
+ clientL2, err := ethclient.Dial(operations.DefaultL2NetworkURL)
72
+ require.NoError(t, err)
73
+ clientL1, err := ethclient.Dial(operations.DefaultL1NetworkURL)
74
+ require.NoError(t, err)
75
+ dacSC, err := polygondatacommittee.NewPolygondatacommittee(
76
+ common.HexToAddress(operations.DefaultL1DataCommitteeContract),
77
+ clientL1,
78
+ )
79
+ require.NoError(t, err)
80
+
81
+ // Register committe with N / M signatures
82
+ membs := members{}
83
+ addrsBytes := []byte{}
84
+ urls := []string{}
85
+ for i := 0; i < mMembers; i++ {
86
+ pk, err := crypto.GenerateKey()
87
+ require.NoError(t, err)
88
+ membs = append(membs, member{
89
+ addr: crypto.PubkeyToAddress(pk.PublicKey),
90
+ pk: pk,
91
+ url: fmt.Sprintf("http://cdk-data-availability-%d:420%d", i, i),
92
+ i: i,
93
+ })
94
+ }
95
+ sort.Sort(membs)
96
+ for _, m := range membs {
97
+ addrsBytes = append(addrsBytes, m.addr.Bytes()...)
98
+ urls = append(urls, m.url)
99
+ }
100
+ tx, err := dacSC.SetupCommittee(authL1, big.NewInt(nSignatures), urls, addrsBytes)
101
+ for _, m := range membs {
102
+ fmt.Println(m.addr)
103
+ }
104
+ require.NoError(t, err)
105
+ err = operations.WaitTxToBeMined(ctx, clientL1, tx, operations.DefaultTimeoutTxToBeMined)
106
+ require.NoError(t, err)
107
+
108
+ // Spin up M DAC nodes
109
+ dacNodeConfig := config.Config{
110
+ L1: config.L1Config{
111
+ RpcURL: "http://zkevm-mock-l1-network:8545",
112
+ WsURL: "ws://zkevm-mock-l1-network:8546",
113
+ PolygonValidiumAddress: operations.DefaultL1ZkEVMSmartContract,
114
+ DataCommitteeAddress: operations.DefaultL1DataCommitteeContract,
115
+ Timeout: cTypes.Duration{Duration: time.Second},
116
+ RetryPeriod: cTypes.Duration{Duration: time.Second},
117
+ },
118
+ PrivateKey: cTypes.KeystoreFileConfig{
119
+ Path: ksFile,
120
+ Password: ksPass,
121
+ },
122
+ DB: db.Config{
123
+ Name: "committee_db",
124
+ User: "committee_user",
125
+ Password: "committee_password",
126
+ Host: "zkevm-data-node-db",
127
+ Port: "5432",
128
+ EnableLog: false,
129
+ MaxConns: 10,
130
+ },
131
+ RPC: rpc.Config{
132
+ Host: "0.0.0.0",
133
+ MaxRequestsPerIPAndSecond: 100,
134
+ },
135
+ }
136
+ defer func() {
137
+ // Remove tmp files
138
+ assert.NoError(t,
139
+ exec.Command("rm", cfgFile).Run(),
140
+ )
141
+ assert.NoError(t,
142
+ exec.Command("rmdir", ksFile+"_").Run(),
143
+ )
144
+ assert.NoError(t,
145
+ exec.Command("rm", ksFile).Run(),
146
+ )
147
+ // Stop DAC nodes
148
+ for i := 0; i < mMembers; i++ {
149
+ assert.NoError(t, exec.Command(
150
+ "docker", "kill", "cdk-data-availability-"+strconv.Itoa(i),
151
+ ).Run())
152
+ assert.NoError(t, exec.Command(
153
+ "docker", "rm", "cdk-data-availability-"+strconv.Itoa(i),
154
+ ).Run())
155
+ }
156
+ // Stop permissionless node
157
+ require.NoError(t, opsman.StopPermissionlessNodeForcedToSYncThroughDAC())
158
+ }()
159
+ // Start permissionless node
160
+ require.NoError(t, opsman.StartPermissionlessNodeForcedToSYncThroughDAC())
161
+ // Star DAC nodes
162
+ for _, m := range membs {
163
+ // Set correct port
164
+ port := 4200 + m.i
165
+ dacNodeConfig.RPC.Port = port
166
+ // Write config file
167
+ file, err := json.MarshalIndent(dacNodeConfig, "", " ")
168
+ require.NoError(t, err)
169
+ err = os.WriteFile(cfgFile, file, 0644)
170
+ require.NoError(t, err)
171
+ // Write private key keystore file
172
+ err = createKeyStore(m.pk, ksFile, ksPass)
173
+ require.NoError(t, err)
174
+ // Run DAC node
175
+ cmd := exec.Command(
176
+ "docker", "run", "-d",
177
+ "--name", "cdk-data-availability-"+strconv.Itoa(m.i),
178
+ "-v", cfgFile+":/app/config.json",
179
+ "-v", ksFile+":"+ksFile,
180
+ "--network", "zkevm",
181
+ dacNodeContainer,
182
+ "/bin/sh", "-c",
183
+ "/app/cdk-data-availability run --cfg /app/config.json",
184
+ )
185
+ out, err := cmd.CombinedOutput()
186
+ require.NoError(t, err, string(out))
187
+ log.Infof("DAC node %d started", m.i)
188
+ time.Sleep(time.Second * 5)
189
+ }
190
+
191
+ // Send txs
192
+ nTxs := 10
193
+ amount := big.NewInt(10000)
194
+ toAddress := common.HexToAddress("0x70997970C51812dc3A010C7d01b50e0d17dc79C8")
195
+ _, err = clientL2.BalanceAt(ctx, authL2.From, nil)
196
+ require.NoError(t, err)
197
+ _, err = clientL2.PendingNonceAt(ctx, authL2.From)
198
+ require.NoError(t, err)
199
+
200
+ gasLimit, err := clientL2.EstimateGas(ctx, ethereum.CallMsg{From: authL2.From, To: &toAddress, Value: amount})
201
+ require.NoError(t, err)
202
+
203
+ gasPrice, err := clientL2.SuggestGasPrice(ctx)
204
+ require.NoError(t, err)
205
+
206
+ nonce, err := clientL2.PendingNonceAt(ctx, authL2.From)
207
+ require.NoError(t, err)
208
+
209
+ txs := make([]*eTypes.Transaction, 0, nTxs)
210
+ for i := 0; i < nTxs; i++ {
211
+ tx := eTypes.NewTransaction(nonce+uint64(i), toAddress, amount, gasLimit, gasPrice, nil)
212
+ log.Infof("generating tx %d / %d: %s", i+1, nTxs, tx.Hash().Hex())
213
+ txs = append(txs, tx)
214
+ }
215
+
216
+ // Wait for verification
217
+ _, err = operations.ApplyL2Txs(ctx, txs, authL2, clientL2, operations.VerifiedConfirmationLevel)
218
+ require.NoError(t, err)
219
+
220
+ // Assert that he permissionless node is fully synced (through the DAC)
221
+ time.Sleep(30 * time.Second) // Give some time for the permissionless node to get synced
222
+ clientL2Permissionless, err := ethclient.Dial(operations.PermissionlessL2NetworkURL)
223
+ require.NoError(t, err)
224
+ expectedBlock, err := clientL2.BlockByNumber(ctx, nil)
225
+ require.NoError(t, err)
226
+ actualBlock, err := clientL2Permissionless.BlockByNumber(ctx, nil)
227
+ require.NoError(t, err)
228
+ // je, err := expectedBlock.Header().MarshalJSON()
229
+ // require.NoError(t, err)
230
+ // log.Info(string(je))
231
+ // ja, err := actualBlock.Header().MarshalJSON()
232
+ // require.NoError(t, err)
233
+ // log.Info(string(ja))
234
+ // require.Equal(t, string(je), string(ja))
235
+ require.Equal(t, expectedBlock.Root().Hex(), actualBlock.Root().Hex())
236
+ }
237
+
238
+ type member struct {
239
+ addr common.Address
240
+ pk *ecdsa.PrivateKey
241
+ url string
242
+ i int
243
+ }
244
+ type members []member
245
+
246
+ func (s members) Len() int { return len(s) }
247
+ func (s members) Less(i, j int) bool {
248
+ return strings.ToUpper(s[i].addr.Hex()) < strings.ToUpper(s[j].addr.Hex())
249
+ }
250
+ func (s members) Swap(i, j int) { s[i], s[j] = s[j], s[i] }
251
+
252
+ func createKeyStore(pk *ecdsa.PrivateKey, outputDir, password string) error {
253
+ ks := keystore.NewKeyStore(outputDir+"_", keystore.StandardScryptN, keystore.StandardScryptP)
254
+ _, err := ks.ImportECDSA(pk, password)
255
+ if err != nil {
256
+ return err
257
+ }
258
+ fileNameB, err := exec.Command("ls", outputDir+"_/").CombinedOutput()
259
+ fileName := strings.TrimSuffix(string(fileNameB), "\n")
260
+ if err != nil {
261
+ fmt.Println(fileName)
262
+ return err
263
+ }
264
+ out, err := exec.Command("mv", outputDir+"_/"+fileName, outputDir).CombinedOutput()
265
+ if err != nil {
266
+ fmt.Println(string(out))
267
+ return err
268
+ }
269
+ return nil
270
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/debug_calltracer_test.go RENAMED
@@ -258,7 +258,7 @@
258
  require.Equal(t, referenceValueMap["from"], resultMap["from"], fmt.Sprintf("invalid `from` for network %s", networkName))
259
  // TODO: after we fix the full trace and the gas values for create commands, we can enable this check again.
260
  // require.Equal(t, referenceValueMap["gas"], resultMap["gas"], fmt.Sprintf("invalid `gas` for network %s", networkName))
261
- require.Equal(t, referenceValueMap["gasUsed"], resultMap["gasUsed"], fmt.Sprintf("invalid `gasUsed` for network %s", networkName))
262
  require.Equal(t, referenceValueMap["input"], resultMap["input"], fmt.Sprintf("invalid `input` for network %s", networkName))
263
  require.Equal(t, referenceValueMap["output"], resultMap["output"], fmt.Sprintf("invalid `output` for network %s", networkName))
264
  require.Equal(t, referenceValueMap["value"], resultMap["value"], fmt.Sprintf("invalid `value` for network %s", networkName))
 
258
  require.Equal(t, referenceValueMap["from"], resultMap["from"], fmt.Sprintf("invalid `from` for network %s", networkName))
259
  // TODO: after we fix the full trace and the gas values for create commands, we can enable this check again.
260
  // require.Equal(t, referenceValueMap["gas"], resultMap["gas"], fmt.Sprintf("invalid `gas` for network %s", networkName))
261
+ // require.Equal(t, referenceValueMap["gasUsed"], resultMap["gasUsed"], fmt.Sprintf("invalid `gasUsed` for network %s", networkName))
262
  require.Equal(t, referenceValueMap["input"], resultMap["input"], fmt.Sprintf("invalid `input` for network %s", networkName))
263
  require.Equal(t, referenceValueMap["output"], resultMap["output"], fmt.Sprintf("invalid `output` for network %s", networkName))
264
  require.Equal(t, referenceValueMap["value"], resultMap["value"], fmt.Sprintf("invalid `value` for network %s", networkName))
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/forced_batches_test.go RENAMED
@@ -196,7 +196,7 @@
196
  require.NoError(t, err)
197
  genesisConfig, err := config.LoadGenesisFromJSONString(genesisFileAsStr)
198
  require.NoError(t, err)
199
- require.NoError(t, opsman.SetForkID(genesisConfig.Genesis.BlockNumber, forkID6))
200
  err = opsman.Setup()
201
  require.NoError(t, err)
202
  time.Sleep(5 * time.Second)
 
196
  require.NoError(t, err)
197
  genesisConfig, err := config.LoadGenesisFromJSONString(genesisFileAsStr)
198
  require.NoError(t, err)
199
+ require.NoError(t, opsman.SetForkID(genesisConfig.Genesis.RollupBlockNumber, forkID6))
200
  err = opsman.Setup()
201
  require.NoError(t, err)
202
  time.Sleep(5 * time.Second)
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/forced_batches_vector_shared.go RENAMED
@@ -63,8 +63,8 @@
63
  log.Info("# Setting Genesis #")
64
  log.Info("###################")
65
  genesisActions := vectors.GenerateGenesisActions(testCase.Genesis)
66
- require.NoError(t, opsman.SetGenesis(genesisConfig.Genesis.BlockNumber, genesisActions))
67
- require.NoError(t, opsman.SetForkID(genesisConfig.Genesis.BlockNumber, forkID6))
68
  actualOldStateRoot, err := opsman.State().GetLastStateRoot(ctx, nil)
69
  require.NoError(t, err)
70
  require.NoError(t, opsman.Setup())
 
63
  log.Info("# Setting Genesis #")
64
  log.Info("###################")
65
  genesisActions := vectors.GenerateGenesisActions(testCase.Genesis)
66
+ require.NoError(t, opsman.SetGenesis(genesisConfig.Genesis.RollupBlockNumber, genesisActions))
67
+ require.NoError(t, opsman.SetForkID(genesisConfig.Genesis.RollupBlockNumber, forkID6))
68
  actualOldStateRoot, err := opsman.State().GetLastStateRoot(ctx, nil)
69
  require.NoError(t, err)
70
  require.NoError(t, opsman.Setup())
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/e2e/state_test.go RENAMED
@@ -59,7 +59,7 @@
59
  for _, gacc := range testCase.GenesisAccounts {
60
  genesisAccounts[gacc.Address] = gacc.Balance.Int
61
  }
62
- require.NoError(t, opsman.SetGenesisAccountsBalance(genesisConfig.Genesis.BlockNumber, genesisAccounts))
63
 
64
  // Check initial root
65
  require.NoError(t, opsman.CheckVirtualRoot(testCase.ExpectedOldRoot))
 
59
  for _, gacc := range testCase.GenesisAccounts {
60
  genesisAccounts[gacc.Address] = gacc.Balance.Int
61
  }
62
+ require.NoError(t, opsman.SetGenesisAccountsBalance(genesisConfig.Genesis.RollupBlockNumber, genesisAccounts))
63
 
64
  // Check initial root
65
  require.NoError(t, opsman.CheckVirtualRoot(testCase.ExpectedOldRoot))
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/Makefile RENAMED
@@ -26,6 +26,7 @@
26
  DOCKERCOMPOSEZKPROVER := zkevm-prover
27
  DOCKERCOMPOSEPERMISSIONLESSDB := zkevm-permissionless-db
28
  DOCKERCOMPOSEPERMISSIONLESSNODE := zkevm-permissionless-node
 
29
  DOCKERCOMPOSEPERMISSIONLESSZKPROVER := zkevm-permissionless-prover
30
  DOCKERCOMPOSENODEAPPROVE := zkevm-approve
31
  DOCKERCOMPOSENODEAPPROVEV1TOV2 := zkevm-approve-v1tov2
@@ -62,6 +63,7 @@
62
 
63
  RUNPERMISSIONLESSDB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSDB)
64
  RUNPERMISSIONLESSNODE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSNODE)
 
65
  RUNPERMISSIONLESSZKPROVER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER)
66
 
67
  RUNAPPROVE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSENODEAPPROVE)
@@ -101,6 +103,7 @@
101
 
102
  STOPPERMISSIONLESSDB := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSDB) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSDB)
103
  STOPPERMISSIONLESSNODE := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSNODE) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSNODE)
 
104
  STOPPERMISSIONLESSZKPROVER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER)
105
 
106
  STOPAPPROVE := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSENODEAPPROVE) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSENODEAPPROVE)
@@ -110,6 +113,9 @@
110
 
111
  STOP := $(DOCKERCOMPOSE) down --remove-orphans
112
 
 
 
 
113
  .PHONY: test-full-non-e2e
114
  test-full-non-e2e: stop ## Runs non-e2e tests checking race conditions
115
  $(RUNSTATEDB)
@@ -248,6 +254,17 @@
248
  docker logs $(DOCKERCOMPOSEZKPROVER)
249
  trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -failfast -race -v -p 1 -timeout 2000s ../ci/e2e-group11/...
250
 
 
 
 
 
 
 
 
 
 
 
 
251
  .PHONY: benchmark-sequencer-eth-transfers
252
  benchmark-sequencer-eth-transfers: stop
253
  $(RUNL1NETWORK)
@@ -685,10 +702,12 @@
685
  .PHONY: generate-mocks-synchronizer
686
  generate-mocks-synchronizer: ## Generates mocks for synchronizer , using mockery tool
687
  ## mocks for synchronizer
688
- #export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=EthermanInterface --dir=../synchronizer --output=../synchronizer --outpkg=synchronizer --structname=ethermanMock --filename=mock_etherman.go ${COMMON_MOCKERY_PARAMS}
689
- #export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=stateInterface --dir=../synchronizer --output=../synchronizer --outpkg=synchronizer --structname=StateMock --filename=mock_state.go ${COMMON_MOCKERY_PARAMS}
690
- #export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ethTxManager --dir=../synchronizer --output=../synchronizer --outpkg=synchronizer --structname=ethTxManagerMock --filename=mock_ethtxmanager.go ${COMMON_MOCKERY_PARAMS}
691
- #export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=poolInterface --dir=../synchronizer --output=../synchronizer --outpkg=synchronizer --structname=poolMock --filename=mock_pool.go ${COMMON_MOCKERY_PARAMS}
 
 
692
  for i in l1RollupProducerInterface l1RollupConsumerInterface worker synchronizerProcessBlockRangeInterface workersInterface L1ParallelEthermanInterface; do \
693
  camelcase=$$(echo $$i | sed 's/\([a-z0-9]\)\([A-Z]\)/\1_\2/g' | tr '[:upper:]' '[:lower:]') ; \
694
  echo $$camelcase ; \
@@ -722,6 +741,8 @@
722
 
723
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=poolInterface --dir=../gasprice --output=../gasprice --outpkg=gasprice --structname=poolMock --filename=mock_pool.go
724
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ethermanInterface --dir=../gasprice --output=../gasprice --outpkg=gasprice --structname=ethermanMock --filename=mock_etherman.go
 
 
725
 
726
  .PHONY: generate-mocks-aggregator
727
  generate-mocks-aggregator: ## Generates mocks for aggregator , using mockery tool
@@ -745,6 +766,27 @@
745
  run-benchmarks: run-db ## Runs benchmars
746
  go test -bench=. ./state/tree
747
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
748
  .PHONY: compile-scs
749
  compile-scs: ## Compiles smart contracts, configuration in test/contracts/index.yaml
750
  go run ./scripts/cmd... compilesc --input ./contracts
 
26
  DOCKERCOMPOSEZKPROVER := zkevm-prover
27
  DOCKERCOMPOSEPERMISSIONLESSDB := zkevm-permissionless-db
28
  DOCKERCOMPOSEPERMISSIONLESSNODE := zkevm-permissionless-node
29
+ DOCKERCOMPOSEPERMISSIONLESSNODEDAC := zkevm-node-forced-DAC
30
  DOCKERCOMPOSEPERMISSIONLESSZKPROVER := zkevm-permissionless-prover
31
  DOCKERCOMPOSENODEAPPROVE := zkevm-approve
32
  DOCKERCOMPOSENODEAPPROVEV1TOV2 := zkevm-approve-v1tov2
 
63
 
64
  RUNPERMISSIONLESSDB := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSDB)
65
  RUNPERMISSIONLESSNODE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSNODE)
66
+ RUNPERMISSIONLESSNODEDAC := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSNODEDAC)
67
  RUNPERMISSIONLESSZKPROVER := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER)
68
 
69
  RUNAPPROVE := $(DOCKERCOMPOSE) up -d $(DOCKERCOMPOSENODEAPPROVE)
 
103
 
104
  STOPPERMISSIONLESSDB := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSDB) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSDB)
105
  STOPPERMISSIONLESSNODE := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSNODE) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSNODE)
106
+ STOPPERMISSIONLESSNODEDAC := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSNODEDAC) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSNODEDAC)
107
  STOPPERMISSIONLESSZKPROVER := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSEPERMISSIONLESSZKPROVER)
108
 
109
  STOPAPPROVE := $(DOCKERCOMPOSE) stop $(DOCKERCOMPOSENODEAPPROVE) && $(DOCKERCOMPOSE) rm -f $(DOCKERCOMPOSENODEAPPROVE)
 
113
 
114
  STOP := $(DOCKERCOMPOSE) down --remove-orphans
115
 
116
+ RUNDACDB := docker-compose up -d zkevm-data-node-db
117
+ STOPDACDB := docker-compose stop zkevm-data-node-db && docker-compose rm -f zkevm-data-node-db
118
+
119
  .PHONY: test-full-non-e2e
120
  test-full-non-e2e: stop ## Runs non-e2e tests checking race conditions
121
  $(RUNSTATEDB)
 
254
  docker logs $(DOCKERCOMPOSEZKPROVER)
255
  trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -failfast -race -v -p 1 -timeout 2000s ../ci/e2e-group11/...
256
 
257
+ .PHONY: test-e2e-group-cdk-validium-1
258
+ test-e2e-group-cdk-validium-1: stop ## Runs cdk-validium-1 e2e tests checking race conditions
259
+ $(RUNSTATEDB)
260
+ $(RUNPOOLDB)
261
+ $(RUNEVENTDB)
262
+ sleep 5
263
+ $(RUNZKPROVER)
264
+ docker ps -a
265
+ docker logs $(DOCKERCOMPOSEZKPROVER)
266
+ trap '$(STOP)' EXIT; MallocNanoZone=0 go test -count=1 -race -v -p 1 -timeout 2000s ../ci/e2e-group-cdk-validium-1/...
267
+
268
  .PHONY: benchmark-sequencer-eth-transfers
269
  benchmark-sequencer-eth-transfers: stop
270
  $(RUNL1NETWORK)
 
702
  .PHONY: generate-mocks-synchronizer
703
  generate-mocks-synchronizer: ## Generates mocks for synchronizer , using mockery tool
704
  ## mocks for synchronizer
705
+ export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=EthermanFullInterface --dir=../synchronizer/common/syncinterfaces --output=../synchronizer --outpkg=synchronizer --structname=ethermanMock --filename=mock_etherman.go ${COMMON_MOCKERY_PARAMS}
706
+ export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=StateFullInterface --dir=../synchronizer/common/syncinterfaces --output=../synchronizer --outpkg=synchronizer --structname=StateMock --filename=mock_state.go ${COMMON_MOCKERY_PARAMS}
707
+ export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=EthTxManager --dir=../synchronizer/common/syncinterfaces --output=../synchronizer --outpkg=synchronizer --structname=ethTxManagerMock --filename=mock_ethtxmanager.go ${COMMON_MOCKERY_PARAMS}
708
+ export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=PoolInterface --dir=../synchronizer/common/syncinterfaces --output=../synchronizer --outpkg=synchronizer --structname=poolMock --filename=mock_pool.go ${COMMON_MOCKERY_PARAMS}
709
+ export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=Factory --srcpkg=github.com/0xPolygon/cdk-data-availability/client --output=../synchronizer --outpkg=synchronizer --structname=dataCommitteeClientFactoryMock --filename=mock_datacommitteeclientfactory.go ${COMMON_MOCKERY_PARAMS}
710
+ export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=Client --srcpkg=github.com/0xPolygon/cdk-data-availability/client --output=../synchronizer --outpkg=synchronizer --structname=dataCommitteeClientMock --filename=mock_datacommitteeclient.go ${COMMON_MOCKERY_PARAMS}
711
  for i in l1RollupProducerInterface l1RollupConsumerInterface worker synchronizerProcessBlockRangeInterface workersInterface L1ParallelEthermanInterface; do \
712
  camelcase=$$(echo $$i | sed 's/\([a-z0-9]\)\([A-Z]\)/\1_\2/g' | tr '[:upper:]' '[:lower:]') ; \
713
  echo $$camelcase ; \
 
741
 
742
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=poolInterface --dir=../gasprice --output=../gasprice --outpkg=gasprice --structname=poolMock --filename=mock_pool.go
743
  export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=ethermanInterface --dir=../gasprice --output=../gasprice --outpkg=gasprice --structname=ethermanMock --filename=mock_etherman.go
744
+
745
+ export "GOROOT=$$(go env GOROOT)" && $$(go env GOPATH)/bin/mockery --name=dataAvailabilityProvider --dir=../etherman --output=../etherman --outpkg=etherman --structname=daMock --filename=mock_da.go
746
 
747
  .PHONY: generate-mocks-aggregator
748
  generate-mocks-aggregator: ## Generates mocks for aggregator , using mockery tool
 
766
  run-benchmarks: run-db ## Runs benchmars
767
  go test -bench=. ./state/tree
768
 
769
+ .PHONY: run-dac-db
770
+ run-dac-db: ## Suns the DAC DB
771
+ $(RUNDACDB)
772
+
773
+ .PHONY: stop-dac-db
774
+ stop-dac-db: ## Stops the DAC DB
775
+ $(STOPDACDB)
776
+
777
+ .PHONY: run-permissionless-dac
778
+ run-permissionless-dac: ## Runs a permissionless node that is forced to sync through DAC
779
+ $(RUNPERMISSIONLESSDB)
780
+ sleep 1
781
+ $(RUNPERMISSIONLESSZKPROVER)
782
+ $(RUNPERMISSIONLESSNODEDAC)
783
+
784
+ .PHONY: stop-permissionless-dac
785
+ stop-permissionless-dac: ## Stops the permissionless node that is forced to sync through DAC
786
+ $(STOPPERMISSIONLESSNODEDAC)
787
+ $(STOPPERMISSIONLESSZKPROVER)
788
+ $(STOPPERMISSIONLESSDB)
789
+
790
  .PHONY: compile-scs
791
  compile-scs: ## Compiles smart contracts, configuration in test/contracts/index.yaml
792
  go run ./scripts/cmd... compilesc --input ./contracts
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/operations/manager.go RENAMED
@@ -46,6 +46,7 @@
46
  DefaultL1ZkEVMSmartContract = "0x8dAF17A20c9DBA35f005b6324F493785D239719d"
47
  DefaultL1RollupManagerSmartContract = "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e"
48
  DefaultL1PolSmartContract = "0x5FbDB2315678afecb367f032d93F642f64180aa3"
 
49
  DefaultL1NetworkURL = "http://localhost:8545"
50
  DefaultL1NetworkWebSocketURL = "ws://localhost:8546"
51
  DefaultL1ChainID uint64 = 1337
@@ -263,7 +264,6 @@
263
  if confirmationLevel == PoolConfirmationLevel {
264
  return nil, nil
265
  }
266
-
267
  l2BlockNumbers := make([]*big.Int, 0, len(sentTxs))
268
  for _, tx := range sentTxs {
269
  // check transaction nonce against transaction reported L2 block number
@@ -662,3 +662,23 @@
662
  panic(err)
663
  }
664
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  DefaultL1ZkEVMSmartContract = "0x8dAF17A20c9DBA35f005b6324F493785D239719d"
47
  DefaultL1RollupManagerSmartContract = "0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e"
48
  DefaultL1PolSmartContract = "0x5FbDB2315678afecb367f032d93F642f64180aa3"
49
+ DefaultL1DataCommitteeContract = "0x68B1D87F95878fE05B998F19b66F4baba5De1aed"
50
  DefaultL1NetworkURL = "http://localhost:8545"
51
  DefaultL1NetworkWebSocketURL = "ws://localhost:8546"
52
  DefaultL1ChainID uint64 = 1337
 
264
  if confirmationLevel == PoolConfirmationLevel {
265
  return nil, nil
266
  }
 
267
  l2BlockNumbers := make([]*big.Int, 0, len(sentTxs))
268
  for _, tx := range sentTxs {
269
  // check transaction nonce against transaction reported L2 block number
 
662
  panic(err)
663
  }
664
  }
665
+
666
+ // StartDACDB starts the data availability node DB
667
+ func (m *Manager) StartDACDB() error {
668
+ return StartComponent("dac-db", func() (bool, error) { return true, nil })
669
+ }
670
+
671
+ // StopDACDB stops the data availability node DB
672
+ func (m *Manager) StopDACDB() error {
673
+ return StopComponent("dac-db")
674
+ }
675
+
676
+ // StartPermissionlessNodeForcedToSYncThroughDAC starts a permissionless node that is froced to sync through the DAC
677
+ func (m *Manager) StartPermissionlessNodeForcedToSYncThroughDAC() error {
678
+ return StartComponent("permissionless-dac", func() (bool, error) { return true, nil })
679
+ }
680
+
681
+ // StopPermissionlessNodeForcedToSYncThroughDAC stops the permissionless node that is froced to sync through the DAC
682
+ func (m *Manager) StopPermissionlessNodeForcedToSYncThroughDAC() error {
683
+ return StopComponent("permissionless-dac")
684
+ }
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/batchsender/main.go RENAMED
@@ -111,7 +111,7 @@
111
  return err
112
  }
113
 
114
- ethMan, err := etherman.NewClient(cfg.Etherman, cfg.NetworkConfig.L1Config)
115
  if err != nil {
116
  return err
117
  }
@@ -183,7 +183,7 @@
183
  // send to L1
184
  firstSequence := seqs[0]
185
  lastSequence := seqs[len(seqs)-1]
186
- to, data, err := ethMan.BuildSequenceBatchesTxData(auth.From, seqs, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber, auth.From)
187
  if err != nil {
188
  return err
189
  }
 
111
  return err
112
  }
113
 
114
+ ethMan, err := etherman.NewClient(cfg.Etherman, cfg.NetworkConfig.L1Config, nil)
115
  if err != nil {
116
  return err
117
  }
 
183
  // send to L1
184
  firstSequence := seqs[0]
185
  lastSequence := seqs[len(seqs)-1]
186
+ to, data, err := ethMan.BuildSequenceBatchesTxData(auth.From, seqs, uint64(lastSequence.LastL2BLockTimestamp), firstSequence.BatchNumber, auth.From, nil)
187
  if err != nil {
188
  return err
189
  }
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/deploy_sc/main.go RENAMED
@@ -132,6 +132,12 @@
132
  log.Debugf("Sending TX to transfer ETH")
133
  to := common.HexToAddress(receiverAddr)
134
  tx = ethTransfer(ctx, client, auth, to, transferAmount, nil)
 
 
 
 
 
 
135
  err = operations.WaitTxToBeMined(ctx, client, tx, txTimeout)
136
  chkErr(err)
137
  fmt.Println()
 
132
  log.Debugf("Sending TX to transfer ETH")
133
  to := common.HexToAddress(receiverAddr)
134
  tx = ethTransfer(ctx, client, auth, to, transferAmount, nil)
135
+ fmt.Println()
136
+
137
+ // Invalid ETH Transfer
138
+ log.Debugf("Sending Invalid TX to transfer ETH")
139
+ nonce := tx.Nonce() + 1
140
+ ethTransfer(ctx, client, auth, to, transferAmount, &nonce)
141
  err = operations.WaitTxToBeMined(ctx, client, tx, txTimeout)
142
  chkErr(err)
143
  fmt.Println()
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/hash_compare/main.go RENAMED
@@ -1,124 +0,0 @@
1
- package main
2
-
3
- import (
4
- "context"
5
- "errors"
6
- "fmt"
7
- "math/big"
8
- "sync"
9
- "time"
10
-
11
- "github.com/ethereum/go-ethereum"
12
- "github.com/ethereum/go-ethereum/core/types"
13
- "github.com/ethereum/go-ethereum/ethclient"
14
- )
15
-
16
- // add here the url of the nodes you want to check
17
- // against the trusted node
18
- var networkURLsToCheck = []string{
19
- // "https://add.your.node.url.here",
20
- // "https://add.your.node.url.here",
21
- // "https://add.your.node.url.here",
22
- }
23
-
24
- // set the from and to block numbers you want to verify
25
- const fromBlockNumber uint64 = 10
26
- const toBlockNumber uint64 = 20
27
-
28
- // pick the correct trusted Node URL depending on the network you are testing
29
-
30
- // mainnet
31
- const trustedNodeURL = "https://zkevm-rpc.com"
32
-
33
- // cardona
34
- // const trustedNodeURL = "https://rpc.cardona.zkevm-rpc.com/"
35
-
36
- func main() {
37
- fmt.Printf("connecting to network: %v ...", trustedNodeURL)
38
- trustedNodeClient, err := ethclient.Dial(trustedNodeURL)
39
- chkErr(err)
40
- fmt.Print("connected")
41
- fmt.Println()
42
-
43
- networkClients := map[string]*ethclient.Client{}
44
- for _, networkURL := range networkURLsToCheck {
45
- fmt.Printf("connecting to network: %v ...", networkURL)
46
- client, err := ethclient.Dial(networkURL)
47
- chkErr(err)
48
- networkClients[networkURL] = client
49
- fmt.Print("connected")
50
- fmt.Println()
51
- }
52
-
53
- for blockNumberU64 := fromBlockNumber; blockNumberU64 <= toBlockNumber; blockNumberU64++ {
54
- ctx := context.Background()
55
- blockNumber := big.NewInt(0).SetUint64(blockNumberU64)
56
- fmt.Println()
57
- fmt.Println("block to verify: ", blockNumberU64)
58
-
59
- // load blocks from trusted node
60
- trustedNodeBlockHeader, err := trustedNodeClient.HeaderByNumber(ctx, blockNumber)
61
- chkErr(err)
62
- const logPattern = "block: %v hash: %v parentHash: %v network: %v\n"
63
- trustedNodeBlockHash := trustedNodeBlockHeader.Hash().String()
64
- trustedNodeParentBlockHash := trustedNodeBlockHeader.ParentHash.String()
65
-
66
- // load blocks from networks to verify
67
- blocks := sync.Map{}
68
- wg := sync.WaitGroup{}
69
- wg.Add(len(networkURLsToCheck))
70
- for _, networkURL := range networkURLsToCheck {
71
- go func(networkURL string) {
72
- defer wg.Done()
73
- c := networkClients[networkURL]
74
-
75
- blockHeader, err := c.HeaderByNumber(ctx, blockNumber)
76
- if errors.Is(err, ethereum.NotFound) {
77
- return
78
- } else {
79
- chkErr(err)
80
- }
81
-
82
- blocks.Store(networkURL, blockHeader)
83
- }(networkURL)
84
- }
85
- wg.Wait()
86
-
87
- failed := false
88
- blocks.Range(func(networkURLValue, blockValue any) bool {
89
- networkURL, block := networkURLValue.(string), blockValue.(*types.Header)
90
-
91
- // when block is not found
92
- if block == nil {
93
- fmt.Printf(logPattern, blockNumberU64, "NOT FOUND", "NOT FOUND", networkURL)
94
- return true
95
- }
96
-
97
- blockHash := block.Hash().String()
98
- parentBlockHash := block.ParentHash.String()
99
-
100
- if trustedNodeBlockHash != blockHash || trustedNodeParentBlockHash != parentBlockHash {
101
- failed = true
102
- fmt.Printf(logPattern, blockNumberU64, trustedNodeBlockHash, trustedNodeParentBlockHash, trustedNodeURL)
103
- fmt.Printf(logPattern, blockNumberU64, blockHash, parentBlockHash, networkURL)
104
- fmt.Printf("ERROR block information mismatch for network: %v\n", networkURL)
105
- } else {
106
- fmt.Printf("%v: OK\n", networkURL)
107
- }
108
-
109
- return true
110
- })
111
- if failed {
112
- panic("block information mismatch")
113
- }
114
-
115
- // avoid getting blocked by request rate limit
116
- time.Sleep(time.Second)
117
- }
118
- }
119
-
120
- func chkErr(err error) {
121
- if err != nil {
122
- panic(err)
123
- }
124
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/hash_gen/main.go RENAMED
@@ -1,188 +0,0 @@
1
- package main
2
-
3
- import (
4
- "encoding/json"
5
- "fmt"
6
-
7
- "github.com/0xPolygonHermez/zkevm-node/hex"
8
- "github.com/0xPolygonHermez/zkevm-node/jsonrpc/client"
9
- "github.com/0xPolygonHermez/zkevm-node/jsonrpc/types"
10
- "github.com/0xPolygonHermez/zkevm-node/log"
11
- "github.com/ethereum/go-ethereum/common"
12
- ethTypes "github.com/ethereum/go-ethereum/core/types"
13
- "github.com/ethereum/go-ethereum/trie"
14
- )
15
-
16
- const (
17
- networkURL = "https://zkevm-rpc.com"
18
- startBlockNumber uint64 = 10
19
- endBlockNumber uint64 = 20
20
- )
21
-
22
- func main() {
23
- for blockNumber := startBlockNumber; blockNumber <= endBlockNumber; blockNumber++ {
24
- printfLn("getting block: %v", blockNumber)
25
- blockResponse, err := client.JSONRPCCall(networkURL, "eth_getBlockByNumber", hex.EncodeUint64(blockNumber), true)
26
- chkErr(err)
27
- chkRespErr(blockResponse.Error)
28
-
29
- rawBlock := map[string]interface{}{}
30
- err = json.Unmarshal(blockResponse.Result, &rawBlock)
31
- chkErr(err)
32
-
33
- // create header
34
- rawBlockHash := rawBlock["hash"].(string)
35
- number := hex.DecodeBig(rawBlock["number"].(string))
36
- parentHash := common.HexToHash(rawBlock["parentHash"].(string))
37
- coinbase := common.HexToAddress(rawBlock["miner"].(string))
38
- root := common.HexToHash(rawBlock["stateRoot"].(string))
39
- gasUsed := hex.DecodeUint64(rawBlock["gasUsed"].(string))
40
- gasLimit := hex.DecodeUint64(rawBlock["gasLimit"].(string))
41
- timeStamp := hex.DecodeUint64(rawBlock["timestamp"].(string))
42
-
43
- header := &ethTypes.Header{
44
- Number: number, ParentHash: parentHash, Coinbase: coinbase,
45
- Root: root, GasUsed: gasUsed, GasLimit: gasLimit, Time: timeStamp,
46
- }
47
-
48
- // create txs and receipts
49
- rawTransactions := rawBlock["transactions"].([]interface{})
50
- txs := make([]*ethTypes.Transaction, 0, len(rawTransactions))
51
- receipts := make([]*ethTypes.Receipt, 0, len(rawTransactions))
52
- for i, rawTransaction := range rawTransactions {
53
- if i == 1 {
54
- continue
55
- }
56
- rawTransactionMap := rawTransaction.(map[string]interface{})
57
-
58
- nonce := hex.DecodeUint64(rawTransactionMap["nonce"].(string))
59
- gasPrice := hex.DecodeBig(rawTransactionMap["gasPrice"].(string))
60
- gas := hex.DecodeUint64(rawTransactionMap["gas"].(string))
61
- var to *common.Address
62
- if rawTransactionMap["to"] != nil {
63
- aux := common.HexToAddress(rawTransactionMap["to"].(string))
64
- to = &aux
65
- }
66
- value := hex.DecodeBig(rawTransactionMap["value"].(string))
67
- data, _ := hex.DecodeHex(rawTransactionMap["input"].(string))
68
- v := hex.DecodeBig(rawTransactionMap["v"].(string))
69
- r := hex.DecodeBig(rawTransactionMap["r"].(string))
70
- s := hex.DecodeBig(rawTransactionMap["s"].(string))
71
-
72
- tx := ethTypes.NewTx(&ethTypes.LegacyTx{
73
- Nonce: nonce, GasPrice: gasPrice, Gas: gas, To: to,
74
- Value: value, Data: data, V: v, R: r, S: s,
75
- })
76
- txs = append(txs, tx)
77
-
78
- hash := rawTransactionMap["hash"].(string)
79
- printfLn("getting receipt for tx: %v", hash)
80
- receiptResponse, err := client.JSONRPCCall(networkURL, "eth_getTransactionReceipt", hash)
81
- chkErr(err)
82
- chkRespErr(receiptResponse.Error)
83
-
84
- rawReceipt := map[string]interface{}{}
85
- err = json.Unmarshal(receiptResponse.Result, &rawReceipt)
86
- chkErr(err)
87
-
88
- receiptType := uint8(hex.DecodeUint64(rawReceipt["type"].(string)))
89
- postState := common.HexToHash(rawReceipt["root"].(string)).Bytes()
90
- status := hex.DecodeUint64(rawReceipt["status"].(string))
91
- cumulativeGasUsed := hex.DecodeUint64(rawReceipt["cumulativeGasUsed"].(string))
92
- txHash := common.HexToHash(rawReceipt["transactionHash"].(string))
93
- var contractAddress common.Address
94
- if rawReceipt["contractAddress"] != nil {
95
- contractAddress = common.HexToAddress(rawReceipt["contractAddress"].(string))
96
- }
97
- gasUsed := hex.DecodeUint64(rawReceipt["gasUsed"].(string))
98
- blockHash := common.HexToHash(rawReceipt["blockHash"].(string))
99
- blockNumber := hex.DecodeBig(rawReceipt["blockNumber"].(string))
100
- transactionIndex := uint(hex.DecodeUint64(rawReceipt["transactionIndex"].(string)))
101
-
102
- receipt := &ethTypes.Receipt{
103
- Type: receiptType, PostState: postState, Status: status, CumulativeGasUsed: cumulativeGasUsed,
104
- TxHash: txHash, ContractAddress: contractAddress, GasUsed: gasUsed,
105
- BlockHash: blockHash, BlockNumber: blockNumber, TransactionIndex: transactionIndex,
106
- }
107
-
108
- rawLogs := rawReceipt["logs"].([]interface{})
109
- logs := make([]*ethTypes.Log, 0, len(rawLogs))
110
- printfLn("logs: %v", len(rawLogs))
111
- for _, rawLog := range rawLogs {
112
- rawLogMap := rawLog.(map[string]interface{})
113
-
114
- address := common.HexToAddress(rawLogMap["address"].(string))
115
- data, _ := hex.DecodeHex(rawLogMap["data"].(string))
116
- blockNumber := hex.DecodeUint64(rawLogMap["blockNumber"].(string))
117
- txHash := common.HexToHash(rawLogMap["transactionHash"].(string))
118
- txIndex := uint(hex.DecodeUint64(rawLogMap["transactionIndex"].(string)))
119
- blockHash := common.HexToHash(rawLogMap["blockHash"].(string))
120
- index := uint(hex.DecodeUint64(rawLogMap["logIndex"].(string)))
121
- removed := rawLogMap["removed"].(bool)
122
-
123
- log := &ethTypes.Log{
124
- Address: address,
125
- Data: data,
126
- BlockNumber: blockNumber,
127
- TxHash: txHash,
128
- TxIndex: txIndex,
129
- BlockHash: blockHash,
130
- Index: index,
131
- Removed: removed,
132
- }
133
- logs = append(logs, log)
134
-
135
- rawTopics := rawLogMap["topics"].([]interface{})
136
- topics := make([]common.Hash, 0, len(rawTopics))
137
- for _, rawTopic := range rawTopics {
138
- topic := common.HexToHash(rawTopic.(string))
139
- topics = append(topics, topic)
140
- }
141
- log.Topics = topics
142
- }
143
- receipt.Logs = logs
144
-
145
- // RPC is not setting the receipt bloom when computing the block hash
146
- // receipt.Bloom = ethTypes.CreateBloom([]*ethTypes.Receipt{receipt})
147
-
148
- receipts = append(receipts, receipt)
149
- }
150
-
151
- uncles := []*ethTypes.Header{}
152
-
153
- builtBlock := ethTypes.NewBlock(header, txs, uncles, receipts, &trie.StackTrie{})
154
-
155
- match := rawBlockHash == builtBlock.Hash().String()
156
-
157
- log.Infof(" RPC block hash: %v", rawBlockHash)
158
- log.Infof("Computed block hash: %v", builtBlock.Hash().String())
159
- if !match {
160
- log.Errorf(" block hashes DO NOT match")
161
- } else {
162
- log.Infof(" block hashes MATCH")
163
- }
164
- }
165
- }
166
-
167
- func chkRespErr(err *types.ErrorObject) {
168
- if err != nil {
169
- errMsg := fmt.Sprintf("%v %v", err.Code, err.Message)
170
- errorfLn(errMsg)
171
- panic(err)
172
- }
173
- }
174
-
175
- func chkErr(err error) {
176
- if err != nil {
177
- errorfLn(err.Error())
178
- panic(err)
179
- }
180
- }
181
-
182
- func errorfLn(format string, args ...interface{}) {
183
- printfLn("ERROR: "+format, args...)
184
- }
185
-
186
- func printfLn(format string, args ...interface{}) {
187
- fmt.Printf(format+" \n", args...)
188
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
{/home/stefan/go/src/Polygon/zkevm-node → .}/test/scripts/http_ws_sync/main.go RENAMED
@@ -1,161 +0,0 @@
1
- package main
2
-
3
- import (
4
- "context"
5
- "fmt"
6
- "math/big"
7
- "os"
8
- "os/signal"
9
- "sync"
10
- "sync/atomic"
11
- "syscall"
12
- "time"
13
-
14
- "github.com/ethereum/go-ethereum"
15
- "github.com/ethereum/go-ethereum/core/types"
16
- "github.com/ethereum/go-ethereum/ethclient"
17
- "github.com/ethereum/go-ethereum/rpc"
18
- )
19
-
20
- func main() {
21
- const httpUrl = "https://zkevm-rpc.com"
22
- const wsUrl = "wss://ws.zkevm-rpc.com"
23
-
24
- const numberOfConnections = 10
25
- const intervalToCheckBlockNumber = 2 * time.Second
26
-
27
- const enableLogSubscription = true
28
-
29
- wg := sync.WaitGroup{}
30
- wg.Add(numberOfConnections)
31
- for connID := 0; connID < numberOfConnections; connID++ {
32
- go func(connID int) {
33
- ctx := context.Background()
34
-
35
- logf(connID, "connecting to: %v\n", httpUrl)
36
- httpClient, err := ethclient.Dial(httpUrl)
37
- chkErr(connID, err)
38
- logf(connID, "connected to: %v\n", httpUrl)
39
-
40
- latestBlockNumber, err := httpClient.BlockNumber(ctx)
41
- chkErr(connID, err)
42
-
43
- logf(connID, "connecting to: %v\n", wsUrl)
44
- wsClient, err := ethclient.Dial(wsUrl)
45
- chkErr(connID, err)
46
- logf(connID, "connected to: %v\n", wsUrl)
47
-
48
- signals := make(chan os.Signal, 100)
49
- signal.Notify(signals, os.Interrupt, syscall.SIGTERM)
50
-
51
- lastWSBlockNumber := uint64(0)
52
- numberOfLogsReceived := uint64(0)
53
-
54
- // concurrently check block synchronization and logs received
55
- go func(connID int, httpClient *ethclient.Client) {
56
- for {
57
- if lastWSBlockNumber != 0 {
58
- httpBlockNumber, err := httpClient.BlockNumber(ctx)
59
- if err != nil {
60
- logf(connID, "%v failed to check block sync, retrying...\n", time.Now().Format(time.RFC3339Nano))
61
- time.Sleep(intervalToCheckBlockNumber)
62
- continue
63
- }
64
-
65
- wsBlockNumber := atomic.LoadUint64(&lastWSBlockNumber)
66
-
67
- diff := httpBlockNumber - wsBlockNumber
68
- logf(connID, "%v wsBlockNumber: %v httpBlockNumber: %v diff: %v\n", time.Now().Format(time.RFC3339Nano), wsBlockNumber, httpBlockNumber, diff)
69
- }
70
- if numberOfLogsReceived > 0 {
71
- logf(connID, "%v logs received: %v\n", time.Now().Format(time.RFC3339Nano), numberOfLogsReceived)
72
- }
73
-
74
- time.Sleep(intervalToCheckBlockNumber)
75
- }
76
- }(connID, httpClient)
77
-
78
- newHeaders := make(chan *types.Header)
79
- subHeaders, err := wsClient.SubscribeNewHead(ctx, newHeaders)
80
- chkErr(connID, err)
81
- logf(connID, "subscribed to newHeads\n")
82
-
83
- newLogs := make(chan types.Log)
84
- var subLogs ethereum.Subscription = &rpc.ClientSubscription{}
85
- if enableLogSubscription {
86
- subLogs, err = wsClient.SubscribeFilterLogs(ctx, ethereum.FilterQuery{
87
- FromBlock: big.NewInt(0).SetUint64(latestBlockNumber),
88
- ToBlock: big.NewInt(0).SetUint64(latestBlockNumber + 10000),
89
- }, newLogs)
90
- chkErr(connID, err)
91
- logf(connID, "subscribed to filterLogs\n")
92
- }
93
-
94
- // concurrently infinite sending messages
95
- go func(connID int, ctx context.Context, wsClient *ethclient.Client) {
96
- for {
97
- //bn, err := wsClient.BlockNumber(ctx)
98
- _, err := wsClient.BlockNumber(ctx)
99
- if err != nil {
100
- errorf(connID, "ERROR: %v\n", err.Error())
101
- }
102
- // logf(connID, "block number retrieved via message: %v\n", bn)
103
- time.Sleep(time.Second)
104
- }
105
- }(connID, ctx, wsClient)
106
-
107
- out:
108
- for {
109
- select {
110
- case err := <-subHeaders.Err():
111
- if err != nil {
112
- errorf(connID, "%v\n", err.Error())
113
- wg.Done()
114
- break out
115
- }
116
- case err := <-subLogs.Err():
117
- if err != nil {
118
- errorf(connID, "%v\n", err.Error())
119
- wg.Done()
120
- break out
121
- }
122
- case header := <-newHeaders:
123
- atomic.StoreUint64(&lastWSBlockNumber, header.Number.Uint64())
124
- // logf(connID, "%v L2 Block Received: %v\n", time.Now().Format(time.RFC3339Nano), header.Number.Uint64())
125
- case <-newLogs:
126
- atomic.AddUint64(&numberOfLogsReceived, 1)
127
- // logf(connID, "%v Log Received: %v - %v\n", time.Now().Format(time.RFC3339Nano), log.TxHash.String(), log.Index)
128
- case <-signals:
129
- subHeaders.Unsubscribe()
130
- if enableLogSubscription {
131
- subLogs.Unsubscribe()
132
- }
133
- logf(connID, "unsubscribed\n")
134
- close(newHeaders)
135
- close(newLogs)
136
- wg.Done()
137
- break out
138
- }
139
- }
140
- }(connID)
141
- }
142
- wg.Wait()
143
- }
144
-
145
- func chkErr(connID int, err error) {
146
- if err != nil {
147
- errorf(connID, err.Error())
148
- os.Exit(0)
149
- }
150
- }
151
-
152
- func logf(connID int, format string, args ...any) {
153
- msg := fmt.Sprintf(format, args...)
154
- fmt.Printf("[connID: %v] %v", connID, msg)
155
- }
156
-
157
- func errorf(connID int, format string, args ...any) {
158
- msg := fmt.Sprintf(format, args...)
159
- msg = fmt.Sprintf("*****ERROR: %v", msg)
160
- logf(connID, msg)
161
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
{/home/stefan/go/src/Polygon/zkevm-node → .}/tools/egp/main.go RENAMED
@@ -25,45 +25,36 @@
25
  )
26
 
27
  var (
28
- showErrors bool
29
- showLosses bool
30
- showReprocess bool
31
- showDetail bool
32
- showAlways bool
33
- showOnlyCfg bool
34
- useRealL2GasPrice bool
35
- showDiscrepancy uint64
36
- showEncoded bool
37
  )
38
 
39
  const (
40
- ethTransferGasValue = 21000
41
- signatureBytes = 0
42
- effectivePctBytes = 1
43
- fixedBytesTx = signatureBytes + effectivePctBytes
44
  )
45
 
46
  type egpConfig struct {
47
- ByteGasCost uint64 // gas cost of 1 byte
48
- ZeroGasCost uint64 // gas cost of 1 byte zero
49
- NetProfitFactor float64 // L2 network profit factor
50
- L1GasPriceFactor float64 // L1 gas price factor
51
- L2GasPriceSugFactor float64 // L2 gas price suggester factor
52
- FinalDeviationPct uint64 // max final deviation percentage
53
- L2GasPriceSugFactorPreEGP float64 // L2 gas price suggester factor (pre EGP)
54
- EthTransferGasPrice uint64 // Gas price value for transfer (gas == 21000)
55
- EthTransferL1GasPriceFactor float64 // Gas price for transfer (used if EthTransferGasPrice = 0)
56
  }
57
 
58
  type egpLogRecord struct {
59
  l2BlockNum uint64
60
  l2BlockReceived time.Time
61
  encoded string
62
- hash string
63
  missingLogInfo bool // Flag if egp_log field is empty
64
- realGasPrice float64 // (calculated field) Real price paid by the user (to perform a double check)
65
- txZeroCount uint64 // (calculated field) count transaction zero bytes
66
- txNonZeroCount uint64 // (calculated field) count transaction non zero bytes
67
  LogError string `json:"Error"`
68
  LogEnabled bool `json:"Enabled"`
69
  LogL1GasPrice float64 `json:"L1GasPrice"` // L1 gas price
@@ -97,11 +88,10 @@
97
  totalLoss float64 // Total loss gas amount
98
  sumGasFinal float64 // Accumulated sum of final gas (to get average)
99
  countGasFinal float64 // Count number of accumulated (to get average)
100
- sumGasNoEGP float64 // Accumulated sum of gas without EGP
101
- countGasNoEGP float64 // Count number of accumulated without EGP (to get average)
102
  sumFee float64
103
- sumFeeNoEGP float64
104
- sumRealGas float64
105
  }
106
 
107
  func main() {
@@ -140,20 +130,10 @@
140
  Value: false,
141
  },
142
  &cli.BoolFlag{
143
- Name: "showencoded",
144
- Usage: "show encoded field when showing detail record",
145
- Value: false,
146
- },
147
- &cli.BoolFlag{
148
  Name: "showalways",
149
  Usage: "show always full detailed record",
150
  Value: false,
151
  },
152
- &cli.Uint64Flag{
153
- Name: "showdiscrepancy",
154
- Usage: "show discrepancies between real and simulated (0:none, 1:reprocess, 2:gasprice, 3:all)",
155
- Value: ^uint64(0),
156
- },
157
  &cli.StringFlag{
158
  Name: "cfg",
159
  Aliases: []string{"c"},
@@ -165,11 +145,6 @@
165
  Usage: "show only simulation results",
166
  Value: false,
167
  },
168
- &cli.BoolFlag{
169
- Name: "realgasprice",
170
- Usage: "use real L2 gas price from egp-log instead of the calculated simulated value",
171
- Value: false,
172
- },
173
  &cli.StringFlag{
174
  Name: "db",
175
  Usage: "DB connection string: \"host=xxx port=xxx user=xxx dbname=xxx password=xxx\"",
@@ -189,15 +164,14 @@
189
  // defaultConfig parses the default configuration values
190
  func defaultConfig() (*egpConfig, error) {
191
  cfg := egpConfig{
192
- ByteGasCost: 16, // nolint:gomnd
193
- ZeroGasCost: 4, // nolint:gomnd
194
- NetProfitFactor: 1.0, // nolint:gomnd
195
- L1GasPriceFactor: 0.25, // nolint:gomnd
196
- L2GasPriceSugFactor: 0.5, // nolint:gomnd
197
- FinalDeviationPct: 10, // nolint:gomnd
198
- L2GasPriceSugFactorPreEGP: 0.1, // nolint:gomnd
199
- EthTransferGasPrice: 0, // nolint:gomnd
200
- EthTransferL1GasPriceFactor: 0.10, // nolint:gomnd
201
  }
202
 
203
  viper.SetConfigType("toml")
@@ -268,9 +242,6 @@
268
  showDetail = ctx.Bool("showdetail")
269
  showAlways = ctx.Bool("showalways")
270
  showOnlyCfg = ctx.Bool("onlycfg")
271
- useRealL2GasPrice = ctx.Bool("realgasprice")
272
- showDiscrepancy = ctx.Uint64("showdiscrepancy")
273
- showEncoded = ctx.Bool("showencoded")
274
 
275
  // Load simulation config file
276
  var err error
@@ -299,7 +270,7 @@
299
 
300
  // Query data
301
  query := fmt.Sprintf(`
302
- select lb.received_at, t.l2_block_num, coalesce(t.egp_log::varchar,'') as egp_log, t.encoded, t.hash
303
  from state.transaction t
304
  join state.l2block lb on lb.block_num = t.l2_block_num
305
  where t.l2_block_num >= %d and t.l2_block_num <= %d`, fromBlock, toBlock)
@@ -315,14 +286,14 @@
315
  logf("Starting from L2 block %d...", fromBlock)
316
  var blockReceived time.Time
317
  var l2Block uint64
318
- var egpLog, encoded, hash string
 
319
  var timeFirst, timeLast time.Time
320
- var realStats, simulateStats egpStats
321
 
322
  i := uint64(0)
323
  for rows.Next() {
324
  // Fetch row
325
- err = rows.Scan(&blockReceived, &l2Block, &egpLog, &encoded, &hash)
326
  if err != nil {
327
  logf("Error fetching row: %v", err)
328
  return err
@@ -347,38 +318,31 @@
347
  i++
348
 
349
  // Transaction info
350
- egpRealData := egpLogRecord{
351
  l2BlockReceived: blockReceived,
352
  l2BlockNum: l2Block,
353
  encoded: encoded,
354
- hash: hash,
355
  missingLogInfo: egpLog == "",
356
- realGasPrice: 0,
357
- txZeroCount: 0,
358
- txNonZeroCount: 0,
359
  }
360
 
361
  // Check if EGP info is present
362
  if egpLog != "" {
363
  // Decode EGP log json
364
- err = json.Unmarshal([]byte(egpLog), &egpRealData)
365
  if err != nil {
366
  logf("Error decoding json from egp_log field: %v", err)
367
  return err
368
  }
369
-
370
- // Calculated fields
371
- egpRealData.realGasPrice = roundEffectiveGasPrice(egpRealData.LogGasPrice, egpRealData.LogPercentage)
372
  }
373
 
374
  // Calculate stats
375
- countStats(i, l2Block, &egpRealData, &realStats, nil, nil)
376
 
377
  // Simulate using alternative config
378
  if egpCfg != nil {
379
- egpSimData := egpRealData
380
  simulateConfig(&egpSimData, egpCfg)
381
- countStats(i, l2Block, &egpSimData, &simulateStats, egpCfg, &egpRealData)
382
  }
383
  }
384
 
@@ -389,39 +353,25 @@
389
  logf("\nPERIOD [%.2f days]: %v ... %v", diff/24, timeFirst, timeLast) // nolint:gomnd
390
  if !showOnlyCfg {
391
  logf("\nEGP REAL STATS:")
392
- printStats(&realStats)
393
  }
394
 
395
  // Print simulation stats results
396
  if egpCfg != nil {
397
  logf("\nEGP SIMULATION STATS:")
398
  printStats(&simulateStats)
399
- var strL2SugFactor string
400
- if useRealL2GasPrice {
401
- strL2SugFactor = "REAL-GASPRICE-USED"
402
- } else {
403
- strL2SugFactor = fmt.Sprintf("%.4f", egpCfg.L2GasPriceSugFactor)
404
- }
405
- logf("PARAMS: byte[%d] zero[%d] netFactor[%.4f] L1factor[%.4f] L2sugFactor[%s] devPct[%d] L2sugPreEGP[%.4f] EthTrsfPrice[%d] EthTrsfL1Fact[%.4f]", egpCfg.ByteGasCost,
406
- egpCfg.ZeroGasCost, egpCfg.NetProfitFactor, egpCfg.L1GasPriceFactor, strL2SugFactor, egpCfg.FinalDeviationPct, egpCfg.L2GasPriceSugFactorPreEGP,
407
- egpCfg.EthTransferGasPrice, egpCfg.EthTransferL1GasPriceFactor)
408
  }
409
 
410
  return nil
411
  }
412
 
413
  // countStats calculates and counts statistics for an EGP record
414
- func countStats(i uint64, block uint64, egp *egpLogRecord, stats *egpStats, cfg *egpConfig, compareEgp *egpLogRecord) {
415
- var title string
416
- if cfg == nil {
417
- title = "REAL EGP-LOG"
418
- } else {
419
- title = "SIM CONFIG"
420
- }
421
-
422
  // Show record information
423
  if showAlways {
424
- printEgpLogRecord(egp, showEncoded, title, cfg == nil)
425
  }
426
 
427
  // Total transactions
@@ -433,7 +383,7 @@
433
  if showErrors {
434
  fmt.Printf("egp-error:#%d:(L2 block [%d] %v):%s\n", i, block, egp.l2BlockReceived, egp.LogError)
435
  if showDetail && !showAlways {
436
- printEgpLogRecord(egp, showEncoded, title, cfg == nil)
437
  }
438
  }
439
  }
@@ -454,7 +404,7 @@
454
  if showReprocess {
455
  fmt.Printf("egp-reprocess:#%d:(L2 block [%d] %v)\n", i, block, egp.l2BlockReceived)
456
  if showDetail && !showAlways {
457
- printEgpLogRecord(egp, showEncoded, title, cfg == nil)
458
  }
459
  }
460
  }
@@ -480,7 +430,6 @@
480
  // Gas total and average
481
  stats.countGasFinal++
482
  stats.sumGasFinal += egp.LogValueFinal
483
- stats.sumRealGas += egp.realGasPrice
484
 
485
  // Gas total and average without EGP
486
  var l2SugPreEGP float64
@@ -490,9 +439,9 @@
490
  l2SugPreEGP = 0.1
491
  }
492
 
493
- stats.countGasNoEGP++
494
- stats.sumGasNoEGP += egp.LogL1GasPrice * l2SugPreEGP
495
- stats.sumFeeNoEGP += egp.LogL1GasPrice * l2SugPreEGP * egp.LogGasUsedSecond
496
 
497
  // Loss
498
  if egp.LogValueFinal == egp.LogGasPrice {
@@ -514,27 +463,10 @@
514
  info := fmt.Sprintf("reprocess=%t, final=%.0f, egp1=%.0f, egp2=%.0f, user=%.0f", egp.LogReprocess, egp.LogValueFinal, egp.LogGasUsedFirst, egp.LogGasUsedSecond, egp.LogGasPrice)
515
  fmt.Printf("egp-loss:#%d:(L2 block [%d] %v):loss=%.0f:info:%s\n", i, block, egp.l2BlockReceived, loss, info)
516
  if showDetail && !showAlways {
517
- printEgpLogRecord(egp, showEncoded, title, cfg == nil)
518
  }
519
  }
520
  }
521
-
522
- // Show discrepancies
523
- if showDiscrepancy > 0 && compareEgp != nil {
524
- var discrepancy bool
525
- if (showDiscrepancy == 2 || showDiscrepancy == 3) && egp.realGasPrice != compareEgp.realGasPrice {
526
- discrepancy = true
527
- fmt.Printf("egp-disc:realgas:#%d:(L2 block [%d] %v):sim=%0.f, real=%0.f\n", i, block, egp.l2BlockReceived, egp.realGasPrice, compareEgp.realGasPrice)
528
- }
529
- if (showDiscrepancy == 1 || showDiscrepancy == 3) && egp.LogReprocess != compareEgp.LogReprocess {
530
- discrepancy = true
531
- fmt.Printf("egp-disc:reprocess:#%d:(L2 block [%d] %v):sim=%t, real=%t\n", i, block, egp.l2BlockReceived, egp.LogReprocess, compareEgp.LogReprocess)
532
- }
533
- if discrepancy && showDetail && !showAlways {
534
- printEgpLogRecord(compareEgp, showEncoded, "REAL", true)
535
- printEgpLogRecord(egp, showEncoded, title, cfg == nil)
536
- }
537
- }
538
  }
539
  }
540
 
@@ -545,10 +477,9 @@
545
  }
546
 
547
  // printEgpLogRecord prints values of egpLogRecord struct
548
- func printEgpLogRecord(record *egpLogRecord, showTxInfo bool, title string, isReal bool) {
549
- fmt.Printf("%s L2BlockNum: [%d]\n", title, record.l2BlockNum)
550
  fmt.Printf(" timestamp: [%v]\n", record.l2BlockReceived)
551
- fmt.Printf(" hash: [%s]\n", record.hash)
552
  fmt.Printf(" Error: [%s]\n", record.LogError)
553
  fmt.Printf(" Enabled: [%t]\n", record.LogEnabled)
554
  fmt.Printf(" L1GasPrice: [%.0f]\n", record.LogL1GasPrice)
@@ -565,11 +496,6 @@
565
  fmt.Printf(" Percentage: [%d]\n", record.LogPercentage)
566
  fmt.Printf(" MaxDeviation: [%.0f]\n", record.LogMaxDeviation)
567
  fmt.Printf(" FinalDeviation: [%.0f]\n", record.LogFinalDeviation)
568
- if !isReal {
569
- fmt.Printf(" *zeroBytes: [%d]\n", record.txZeroCount)
570
- fmt.Printf(" *nonZeroBytes: [%d]\n", record.txNonZeroCount)
571
- }
572
- fmt.Printf(" *realGasPrice: [%0.f]\n", record.realGasPrice)
573
  if showTxInfo {
574
  fmt.Printf(" encoded: [%s]\n", record.encoded)
575
  }
@@ -617,33 +543,30 @@
617
  fmt.Printf(" Tx fee avg...........: [%.0f] (%.3f GWei) (%.9f ETH)\n", stats.sumFee/stats.countGasFinal,
618
  stats.sumFee/stats.countGasFinal/GWEI_DIV, stats.sumFee/stats.countGasFinal/ETH_DIV)
619
  }
620
- if stats.countGasNoEGP > 0 {
621
- fmt.Printf(" Gas pri.avg noEGP....: [%.0f] (%.3f GWei) (%.9f ETH)\n", stats.sumGasNoEGP/stats.countGasNoEGP,
622
- stats.sumGasNoEGP/stats.countGasNoEGP/GWEI_DIV, stats.sumGasNoEGP/stats.countGasNoEGP/ETH_DIV)
623
- }
624
- if stats.countGasNoEGP > 0 {
625
- fmt.Printf(" Tx fee avg noEGP.....: [%.0f] (%.3f GWei) (%.9f ETH)\n", stats.sumFeeNoEGP/stats.countGasNoEGP,
626
- stats.sumFeeNoEGP/stats.countGasNoEGP/GWEI_DIV, stats.sumFeeNoEGP/stats.countGasNoEGP/ETH_DIV)
627
- }
628
- fmt.Printf(" Diff fee EGP-noEGP...: [%.0f] (%.3f Gwei) (%.9f ETH)\n", stats.sumFee-stats.sumFeeNoEGP,
629
- (stats.sumFee-stats.sumFeeNoEGP)/GWEI_DIV, (stats.sumFee-stats.sumFeeNoEGP)/ETH_DIV)
630
- fmt.Printf(" Loss count...........: [%.0f] (%.2f%%)\n", stats.totalLossCount, stats.totalLossCount/statsCount*100) // nolint:gomnd
631
- fmt.Printf(" Loss total.......: [%.0f] (%.3f GWei) (%.9f ETH)\n", stats.totalLoss, stats.totalLoss/GWEI_DIV, stats.totalLoss/ETH_DIV)
632
  if stats.totalLossCount > 0 {
633
- fmt.Printf(" Loss average.....: [%.0f] (%.0f GWei) (%.9f ETH)\n", stats.totalLoss/stats.totalLossCount, stats.totalLoss/stats.totalLossCount/GWEI_DIV,
634
  stats.totalLoss/stats.totalLossCount/ETH_DIV)
635
  }
636
- fmt.Printf(" Real gas price total.: [%.0f] (%.3f GWei) (%.9f ETH)\n", stats.sumRealGas, stats.sumRealGas/GWEI_DIV, stats.sumRealGas/ETH_DIV)
637
  }
638
  }
639
 
640
  // simulateConfig simulates scenario using received config
641
  func simulateConfig(egp *egpLogRecord, cfg *egpConfig) {
642
  // L2 and user gas price
643
- if !useRealL2GasPrice || !egp.LogEnabled {
644
- egp.LogL2GasPrice = egp.LogL1GasPrice * cfg.L2GasPriceSugFactor
645
- egp.LogGasPrice = egp.LogL2GasPrice
646
- }
647
 
648
  // Compute EGP
649
  var err error
@@ -679,66 +602,43 @@
679
  egp.LogValueFinal = egp.LogGasPrice
680
  }
681
  }
682
- // Gas price effective percentage
683
- egp.LogPercentage = calcEffectivePercentage(egp.LogGasPrice, egp.LogValueFinal)
684
  } else {
685
  egp.LogValueSecond = 0
686
 
687
  // Final gas: price signed
688
  egp.LogValueFinal = egp.LogGasPrice
689
- // Gas price effective percentage
690
- egp.LogPercentage = uint64(state.MaxEffectivePercentage)
691
  }
692
 
693
- // Real price paid by the user (to perform a double check)
694
- egp.realGasPrice = roundEffectiveGasPrice(egp.LogGasPrice, egp.LogPercentage)
695
- }
696
-
697
- func calcEffectivePercentage(gasPrice float64, gasEffective float64) uint64 {
698
- if gasPrice > 0 {
699
- return uint64(((gasEffective*256)+gasPrice-1)/gasPrice - 1) // nolint:gomnd
700
  } else {
701
- return 0
702
  }
703
  }
704
 
705
- func roundEffectiveGasPrice(gasPrice float64, pct uint64) float64 {
706
- return gasPrice / 256 * float64(pct+1) // nolint:gomnd
707
- }
708
-
709
  // calcEffectiveGasPrice calculates the effective gas price
710
  func calcEffectiveGasPrice(gasUsed float64, tx *egpLogRecord, cfg *egpConfig) (float64, error) {
711
- // Decode tx
712
- rawBytes, err := decodeTx(tx)
713
- if err != nil {
714
- return 0, err
715
- }
716
-
717
- // Zero and non zero bytes
718
- txZeroBytes := uint64(bytes.Count(rawBytes, []byte{0}))
719
- txNonZeroBytes := uint64(len(rawBytes)) - txZeroBytes
720
- tx.txZeroCount = txZeroBytes
721
- tx.txNonZeroCount = txNonZeroBytes
722
-
723
- if gasUsed == ethTransferGasValue {
724
- // Transfer
725
- if cfg.EthTransferGasPrice != 0 {
726
- return float64(cfg.EthTransferGasPrice), nil
727
- } else if cfg.EthTransferL1GasPriceFactor != 0 {
728
- if tx.LogL1GasPrice == 0 {
729
- return 1, nil
730
- }
731
- return tx.LogL1GasPrice * cfg.EthTransferL1GasPriceFactor, nil
732
- }
733
- }
734
-
735
  // Calculate break even gas price
736
  var breakEvenGasPrice float64
737
  if gasUsed == 0 {
738
  breakEvenGasPrice = tx.LogGasPrice
739
  } else {
 
 
 
 
 
 
 
 
 
 
740
  // Calculates break even gas price
741
  l2MinGasPrice := tx.LogL1GasPrice * cfg.L1GasPriceFactor
 
 
 
742
  totalTxPrice := gasUsed*l2MinGasPrice + float64((fixedBytesTx+txNonZeroBytes)*cfg.ByteGasCost+txZeroBytes*cfg.ZeroGasCost)*tx.LogL1GasPrice
743
  breakEvenGasPrice = totalTxPrice / gasUsed * cfg.NetProfitFactor
744
  }
@@ -746,7 +646,7 @@
746
  // Calculate effective gas price
747
  var ratioPriority float64
748
  if tx.LogGasPrice > tx.LogL2GasPrice {
749
- ratioPriority = tx.LogGasPrice / tx.LogL2GasPrice
750
  } else {
751
  ratioPriority = 1
752
  }
 
25
  )
26
 
27
  var (
28
+ showErrors bool
29
+ showLosses bool
30
+ showReprocess bool
31
+ showDetail bool
32
+ showAlways bool
33
+ showOnlyCfg bool
 
 
 
34
  )
35
 
36
  const (
37
+ signatureBytes = 65
38
+ effectivePctBytes = 1
39
+ fixedBytesTx = signatureBytes + effectivePctBytes
 
40
  )
41
 
42
  type egpConfig struct {
43
+ ByteGasCost uint64 // gas cost of 1 byte
44
+ ZeroGasCost uint64 // gas cost of 1 byte zero
45
+ NetProfitFactor float64 // L2 network profit factor
46
+ L1GasPriceFactor float64 // L1 gas price factor
47
+ L2GasPriceSugFactor float64 // L2 gas price suggester factor
48
+ FinalDeviationPct uint64 // max final deviation percentage
49
+ MinGasPriceAllowed uint64 // min gas price allowed
50
+ L2GasPriceSugFactorPreEGP float64 // L2 gas price suggester factor (pre EGP)
 
51
  }
52
 
53
  type egpLogRecord struct {
54
  l2BlockNum uint64
55
  l2BlockReceived time.Time
56
  encoded string
 
57
  missingLogInfo bool // Flag if egp_log field is empty
 
 
 
58
  LogError string `json:"Error"`
59
  LogEnabled bool `json:"Enabled"`
60
  LogL1GasPrice float64 `json:"L1GasPrice"` // L1 gas price
 
88
  totalLoss float64 // Total loss gas amount
89
  sumGasFinal float64 // Accumulated sum of final gas (to get average)
90
  countGasFinal float64 // Count number of accumulated (to get average)
91
+ sumGasPreEGP float64 // Accumulated sum of gas without EGP
92
+ countGasPreEGP float64 // Count number of accumulated pre EGP (to get average)
93
  sumFee float64
94
+ sumFeePreEGP float64
 
95
  }
96
 
97
  func main() {
 
130
  Value: false,
131
  },
132
  &cli.BoolFlag{
 
 
 
 
 
133
  Name: "showalways",
134
  Usage: "show always full detailed record",
135
  Value: false,
136
  },
 
 
 
 
 
137
  &cli.StringFlag{
138
  Name: "cfg",
139
  Aliases: []string{"c"},
 
145
  Usage: "show only simulation results",
146
  Value: false,
147
  },
 
 
 
 
 
148
  &cli.StringFlag{
149
  Name: "db",
150
  Usage: "DB connection string: \"host=xxx port=xxx user=xxx dbname=xxx password=xxx\"",
 
164
  // defaultConfig parses the default configuration values
165
  func defaultConfig() (*egpConfig, error) {
166
  cfg := egpConfig{
167
+ ByteGasCost: 16, // nolint:gomnd
168
+ ZeroGasCost: 4, // nolint:gomnd
169
+ NetProfitFactor: 1.0, // nolint:gomnd
170
+ L1GasPriceFactor: 0.25, // nolint:gomnd
171
+ L2GasPriceSugFactor: 0.5, // nolint:gomnd
172
+ FinalDeviationPct: 10, // nolint:gomnd
173
+ MinGasPriceAllowed: 1000000000, // nolint:gomnd
174
+ L2GasPriceSugFactorPreEGP: 0.1, // nolint:gomnd
 
175
  }
176
 
177
  viper.SetConfigType("toml")
 
242
  showDetail = ctx.Bool("showdetail")
243
  showAlways = ctx.Bool("showalways")
244
  showOnlyCfg = ctx.Bool("onlycfg")
 
 
 
245
 
246
  // Load simulation config file
247
  var err error
 
270
 
271
  // Query data
272
  query := fmt.Sprintf(`
273
+ select lb.received_at, t.l2_block_num, coalesce(t.egp_log::varchar,'') as egp_log, t.encoded
274
  from state.transaction t
275
  join state.l2block lb on lb.block_num = t.l2_block_num
276
  where t.l2_block_num >= %d and t.l2_block_num <= %d`, fromBlock, toBlock)
 
286
  logf("Starting from L2 block %d...", fromBlock)
287
  var blockReceived time.Time
288
  var l2Block uint64
289
+ var egpLog, encoded string
290
+ var stats, simulateStats egpStats
291
  var timeFirst, timeLast time.Time
 
292
 
293
  i := uint64(0)
294
  for rows.Next() {
295
  // Fetch row
296
+ err = rows.Scan(&blockReceived, &l2Block, &egpLog, &encoded)
297
  if err != nil {
298
  logf("Error fetching row: %v", err)
299
  return err
 
318
  i++
319
 
320
  // Transaction info
321
+ egpData := egpLogRecord{
322
  l2BlockReceived: blockReceived,
323
  l2BlockNum: l2Block,
324
  encoded: encoded,
 
325
  missingLogInfo: egpLog == "",
 
 
 
326
  }
327
 
328
  // Check if EGP info is present
329
  if egpLog != "" {
330
  // Decode EGP log json
331
+ err = json.Unmarshal([]byte(egpLog), &egpData)
332
  if err != nil {
333
  logf("Error decoding json from egp_log field: %v", err)
334
  return err
335
  }
 
 
 
336
  }
337
 
338
  // Calculate stats
339
+ countStats(i, l2Block, &egpData, &stats, nil)
340
 
341
  // Simulate using alternative config
342
  if egpCfg != nil {
343
+ egpSimData := egpData
344
  simulateConfig(&egpSimData, egpCfg)
345
+ countStats(i, l2Block, &egpSimData, &simulateStats, egpCfg)
346
  }
347
  }
348
 
 
353
  logf("\nPERIOD [%.2f days]: %v ... %v", diff/24, timeFirst, timeLast) // nolint:gomnd
354
  if !showOnlyCfg {
355
  logf("\nEGP REAL STATS:")
356
+ printStats(&stats)
357
  }
358
 
359
  // Print simulation stats results
360
  if egpCfg != nil {
361
  logf("\nEGP SIMULATION STATS:")
362
  printStats(&simulateStats)
363
+ logf("PARAMS: byte[%d] zero[%d] netFactor[%.2f] L1factor[%.2f] L2sugFactor[%.2f] devPct[%d] minGas[%d] L2sugPreEGP[%.2f]", egpCfg.ByteGasCost,
364
+ egpCfg.ZeroGasCost, egpCfg.NetProfitFactor, egpCfg.L1GasPriceFactor, egpCfg.L2GasPriceSugFactor, egpCfg.FinalDeviationPct, egpCfg.MinGasPriceAllowed, egpCfg.L2GasPriceSugFactorPreEGP)
 
 
 
 
 
 
 
365
  }
366
 
367
  return nil
368
  }
369
 
370
  // countStats calculates and counts statistics for an EGP record
371
+ func countStats(i uint64, block uint64, egp *egpLogRecord, stats *egpStats, cfg *egpConfig) {
 
 
 
 
 
 
 
372
  // Show record information
373
  if showAlways {
374
+ printEgpLogRecord(egp, false)
375
  }
376
 
377
  // Total transactions
 
383
  if showErrors {
384
  fmt.Printf("egp-error:#%d:(L2 block [%d] %v):%s\n", i, block, egp.l2BlockReceived, egp.LogError)
385
  if showDetail && !showAlways {
386
+ printEgpLogRecord(egp, false)
387
  }
388
  }
389
  }
 
404
  if showReprocess {
405
  fmt.Printf("egp-reprocess:#%d:(L2 block [%d] %v)\n", i, block, egp.l2BlockReceived)
406
  if showDetail && !showAlways {
407
+ printEgpLogRecord(egp, false)
408
  }
409
  }
410
  }
 
430
  // Gas total and average
431
  stats.countGasFinal++
432
  stats.sumGasFinal += egp.LogValueFinal
 
433
 
434
  // Gas total and average without EGP
435
  var l2SugPreEGP float64
 
439
  l2SugPreEGP = 0.1
440
  }
441
 
442
+ stats.countGasPreEGP++
443
+ stats.sumGasPreEGP += egp.LogL1GasPrice * l2SugPreEGP
444
+ stats.sumFeePreEGP += egp.LogL1GasPrice * l2SugPreEGP * egp.LogGasUsedSecond
445
 
446
  // Loss
447
  if egp.LogValueFinal == egp.LogGasPrice {
 
463
  info := fmt.Sprintf("reprocess=%t, final=%.0f, egp1=%.0f, egp2=%.0f, user=%.0f", egp.LogReprocess, egp.LogValueFinal, egp.LogGasUsedFirst, egp.LogGasUsedSecond, egp.LogGasPrice)
464
  fmt.Printf("egp-loss:#%d:(L2 block [%d] %v):loss=%.0f:info:%s\n", i, block, egp.l2BlockReceived, loss, info)
465
  if showDetail && !showAlways {
466
+ printEgpLogRecord(egp, false)
467
  }
468
  }
469
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
470
  }
471
  }
472
 
 
477
  }
478
 
479
  // printEgpLogRecord prints values of egpLogRecord struct
480
+ func printEgpLogRecord(record *egpLogRecord, showTxInfo bool) {
481
+ fmt.Printf("L2BlockNum: [%d]\n", record.l2BlockNum)
482
  fmt.Printf(" timestamp: [%v]\n", record.l2BlockReceived)
 
483
  fmt.Printf(" Error: [%s]\n", record.LogError)
484
  fmt.Printf(" Enabled: [%t]\n", record.LogEnabled)
485
  fmt.Printf(" L1GasPrice: [%.0f]\n", record.LogL1GasPrice)
 
496
  fmt.Printf(" Percentage: [%d]\n", record.LogPercentage)
497
  fmt.Printf(" MaxDeviation: [%.0f]\n", record.LogMaxDeviation)
498
  fmt.Printf(" FinalDeviation: [%.0f]\n", record.LogFinalDeviation)
 
 
 
 
 
499
  if showTxInfo {
500
  fmt.Printf(" encoded: [%s]\n", record.encoded)
501
  }
 
543
  fmt.Printf(" Tx fee avg...........: [%.0f] (%.3f GWei) (%.9f ETH)\n", stats.sumFee/stats.countGasFinal,
544
  stats.sumFee/stats.countGasFinal/GWEI_DIV, stats.sumFee/stats.countGasFinal/ETH_DIV)
545
  }
546
+ if stats.countGasPreEGP > 0 {
547
+ fmt.Printf(" Gas pri.avg preEGP...: [%.0f] (%.3f GWei) (%.9f ETH)\n", stats.sumGasPreEGP/stats.countGasPreEGP,
548
+ stats.sumGasPreEGP/stats.countGasPreEGP/GWEI_DIV, stats.sumGasPreEGP/stats.countGasPreEGP/ETH_DIV)
549
+ }
550
+ if stats.countGasPreEGP > 0 {
551
+ fmt.Printf(" Tx fee avg preEGP....: [%.0f] (%.3f GWei) (%.9f ETH)\n", stats.sumFeePreEGP/stats.countGasPreEGP,
552
+ stats.sumFeePreEGP/stats.countGasPreEGP/GWEI_DIV, stats.sumFeePreEGP/stats.countGasPreEGP/ETH_DIV)
553
+ }
554
+ fmt.Printf(" Diff fee EGP-preEGP..: [%.0f] (%.3f Gwei) (%.9f ETH)\n", stats.sumFee-stats.sumFeePreEGP,
555
+ (stats.sumFee-stats.sumFeePreEGP)/GWEI_DIV, (stats.sumFee-stats.sumFeePreEGP)/ETH_DIV)
556
+ fmt.Printf(" Loss count.......: [%.0f] (%.2f%%)\n", stats.totalLossCount, stats.totalLossCount/statsCount*100) // nolint:gomnd
557
+ fmt.Printf(" Loss total.......: [%.0f] (%.3f GWei) (%.9f ETH)\n", stats.totalLoss, stats.totalLoss/GWEI_DIV, stats.totalLoss/ETH_DIV)
558
  if stats.totalLossCount > 0 {
559
+ fmt.Printf(" Loss average.....: [%.0f] (%.0f GWei) (%.9f ETH)\n", stats.totalLoss/stats.totalLossCount, stats.totalLoss/stats.totalLossCount/GWEI_DIV,
560
  stats.totalLoss/stats.totalLossCount/ETH_DIV)
561
  }
 
562
  }
563
  }
564
 
565
  // simulateConfig simulates scenario using received config
566
  func simulateConfig(egp *egpLogRecord, cfg *egpConfig) {
567
  // L2 and user gas price
568
+ egp.LogL2GasPrice = egp.LogL1GasPrice * cfg.L2GasPriceSugFactor
569
+ egp.LogGasPrice = egp.LogL2GasPrice
 
 
570
 
571
  // Compute EGP
572
  var err error
 
602
  egp.LogValueFinal = egp.LogGasPrice
603
  }
604
  }
 
 
605
  } else {
606
  egp.LogValueSecond = 0
607
 
608
  // Final gas: price signed
609
  egp.LogValueFinal = egp.LogGasPrice
 
 
610
  }
611
 
612
+ // Gas price effective percentage
613
+ if egp.LogGasPrice > 0 {
614
+ egp.LogPercentage = uint64(((egp.LogValueFinal*256)+egp.LogGasPrice-1)/egp.LogGasPrice - 1) // nolint:gomnd
 
 
 
 
615
  } else {
616
+ egp.LogPercentage = 0
617
  }
618
  }
619
 
 
 
 
 
620
  // calcEffectiveGasPrice calculates the effective gas price
621
  func calcEffectiveGasPrice(gasUsed float64, tx *egpLogRecord, cfg *egpConfig) (float64, error) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
622
  // Calculate break even gas price
623
  var breakEvenGasPrice float64
624
  if gasUsed == 0 {
625
  breakEvenGasPrice = tx.LogGasPrice
626
  } else {
627
+ // Decode tx
628
+ rawBytes, err := decodeTx(tx)
629
+ if err != nil {
630
+ return 0, err
631
+ }
632
+
633
+ // Zero and non zero bytes
634
+ txZeroBytes := uint64(bytes.Count(rawBytes, []byte{0}))
635
+ txNonZeroBytes := uint64(len(rawBytes)) - txZeroBytes
636
+
637
  // Calculates break even gas price
638
  l2MinGasPrice := tx.LogL1GasPrice * cfg.L1GasPriceFactor
639
+ if l2MinGasPrice < float64(cfg.MinGasPriceAllowed) {
640
+ l2MinGasPrice = float64(cfg.MinGasPriceAllowed)
641
+ }
642
  totalTxPrice := gasUsed*l2MinGasPrice + float64((fixedBytesTx+txNonZeroBytes)*cfg.ByteGasCost+txZeroBytes*cfg.ZeroGasCost)*tx.LogL1GasPrice
643
  breakEvenGasPrice = totalTxPrice / gasUsed * cfg.NetProfitFactor
644
  }
 
646
  // Calculate effective gas price
647
  var ratioPriority float64
648
  if tx.LogGasPrice > tx.LogL2GasPrice {
649
+ ratioPriority = math.Round(tx.LogGasPrice / tx.LogL2GasPrice)
650
  } else {
651
  ratioPriority = 1
652
  }
{/home/stefan/go/src/Polygon/zkevm-node → .}/tools/state/main.go RENAMED
@@ -32,7 +32,7 @@
32
  networkFlag = cli.StringFlag{
33
  Name: config.FlagNetwork,
34
  Aliases: []string{"net"},
35
- Usage: "Load default network configuration. Supported values: [`mainnet`, `testnet`, `cardona`, `custom`]",
36
  Required: false,
37
  }
38
  customNetworkFlag = cli.StringFlag{
 
32
  networkFlag = cli.StringFlag{
33
  Name: config.FlagNetwork,
34
  Aliases: []string{"net"},
35
+ Usage: "Load default network configuration. Supported values: [`custom`]",
36
  Required: false,
37
  }
38
  customNetworkFlag = cli.StringFlag{
{/home/stefan/go/src/Polygon/zkevm-node → .}/tools/state/reprocess_cmd.go RENAMED
@@ -77,7 +77,7 @@
77
  }
78
 
79
  func newEtherman(c config.Config) (*etherman.Client, error) {
80
- etherman, err := etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config)
81
  if err != nil {
82
  return nil, err
83
  }
 
77
  }
78
 
79
  func newEtherman(c config.Config) (*etherman.Client, error) {
80
+ etherman, err := etherman.NewClient(c.Etherman, c.NetworkConfig.L1Config, nil)
81
  if err != nil {
82
  return nil, err
83
  }